DataError: (1406, "Data too long for column 'name' at row 1")
<p>I've read nearly all other posts with the same error and can't seem to find a proper solution. </p>

<p>In my models.py file I have this:</p>

<pre><code>class LetsSayCups(models.Model):
    name = models.CharField(max_length=65535)

    def __str__(self):
        return str(self.name)
</code></pre>

<p>I get this error when I try to load aws mysql data into my local mysql server. I had the issue occur for another part in my models.py file, and the way I was able to work around it was by going into the my.cnf.bak file and changing the sql_mode from:</p>

<pre><code>sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
</code></pre>

<p>to:</p>

<pre><code>sql_mode=''
</code></pre>

<p>And it worked!!! Until later on I find another error. The specific error is something like this:</p>

<pre><code>...
File "/Users/im_the_user/Desktop/my_company/my_project/load_items.py", line 122, in load_the_items
  existing_cups = Cups.objects.get_or_create(name=cups)
...
django.db.utils.DataError: (1406, "Data too long for column 'name' at row 1")
</code></pre>

<p>The above ... means things came before/after that I left out in this. </p>

<p>Updating my my.cnf.bak file wasnt enough, nor was making the CharField max_length to 65535. What else can I try?</p>

<p>You need to use a <code>TextField</code>. The <code>max_length</code> of a <code>CharField</code> should be set to 255 or less to avoid issues with DBs that store it as <code>VARCHAR</code>.</p>

<p><a href="https://docs.djangoproject.com/en/1.10/ref/databases/#character-fields" rel="nofollow">https://docs.djangoproject.com/en/1.10/ref/databases/#character-fields</a></p>

python mysql django pycharm