报错django.db.utils.InternalError: (1366, "Incorrect string value: '\xxx\xxx\xxx\xxx\xxx\xxx' for column 'name' at row 1")

当你执行 python manage.py migrate 时,提示 django.db.utils.InternalError: (1366, "Incorrect string value: '\xxx\xxx\xxx\xxx\xxx\xxx' for column 'name' at row 1") 错误,不要慌。

这个时候先去看看你的models里面有没有中文字符!

解决方案:
方案一、更改库的默认字符集

创建库的时候指定默认字符集:

 create database 库名 default charset=utf8; 
或者修改现有库的字符集:

 alter database 库名 character set utf8; 
方案二、更改表的默认字符集,

创建表的时候指定默认字符集

 create table 表名 (...) default charset=utf8; 
或者修改现有表的字符集

 alter table 表名 character set utf8; 

原文地址:https://www.cnblogs.com/dsynb/p/14701084.html