0

I just started a new project and change database engine

DATABASES = { 'default': { 'ENGINE': 'mysql.connector.django', 'NAME': 'mysite', 'USER': 'root', 'PASSWORD': 'mypassword', 'HOST': '127.0.0.1', 'PORT': '3306', } 

} then after running python3 manage.py migrate i got an error:

Operations to perform: Apply all migrations: admin, auth, contenttypes, sessions Running migrations: Applying contenttypes.0001_initial...Traceback (most recent call last): File "/usr/local/lib/python3.5/site-packages/mysql/connector/django/base.py", line 177, in _execute_wrapper return method(query, args) File "/usr/local/lib/python3.5/site-packages/mysql/connector/cursor.py", line 515, in execute self._handle_result(self._connection.cmd_query(stmt)) File "/usr/local/lib/python3.5/site-packages/mysql/connector/cursor.py", line 434, in _handle_result self._handle_noresultset(result) File "/usr/local/lib/python3.5/site-packages/mysql/connector/cursor.py", line 404, in _handle_noresultset self._warnings[0][1], self._warnings[0][2]) mysql.connector.errors.DatabaseError: 1265: Data truncated for column 'applied' at row 1 
2
  • 2
    It looks like you shortent a field applied and the data does not fit in there anymore. Commented Oct 24, 2016 at 5:22
  • i hadn't installed my apps,just use 'django.contrib.admin','django.contrib.auth',and so on,how to change the the type of 'applied'? Commented Oct 24, 2016 at 8:36

1 Answer 1

1

You have to:

python3 manage.py makemigrations 

And then:

python3 manage.py migrate 

Then you can safely start the server again

Hope this helps

Sign up to request clarification or add additional context in comments.

2 Comments

unluckily,it doesn't work. if i use sqlite3,it works well.
It did not work for me, either.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.