本来今天高高兴兴,突然:
raise MigrationSchemaMissing("Unable to create the django_migrations table (%s)" % exc)
django.db.migrations.exceptions.MigrationSchemaMissing: Unable to create the django_migrations table ((1064, "You have an error in your SQL sy
ntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(6) NOT NULL)' at line 1"))
上网上搜寻一番,发现是MySql数据库与Django不兼容的原因,我的数据库是MySql Server 5.5版本,而Django2.0以后不再支持MySQL5.5,必须5.6版本以上,所以我下载了MySql 5.7.24。
旧的MySql必须完全删除,清理干净需要删除注册表:
win + R输入:regedit
删除下面的目录
HKEY_LOCAL_MACHINESYSTEMControlSet001ServicesEventlogApplicationMySQL
HKEY_LOCAL_MACHINESYSTEMControlSet002ServicesEventlogApplicationMySQL
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesEventlogApplicationMySQL
或者使用能删除注册表的工具,例如UninstallTool;
下载最新的MySql:
https://dev.mysql.com/downloads/mysql/
安装教程(转):
https://blog.csdn.net/recky_wiers/article/details/79243804
MySql密码忘记:
关闭正在运行的MySQL服务
win+R输入:cmd,转到mysqlin目录
输入:mysqld --skip-grant-tables 回车
新打开dos窗口,转到mysqlin目录
输入mysql回车,显示已经进入mysql
输入:use mysql;
修改密码:
update user set password=password("123456") where user="root";
或者:
update user set authentication_string=password("123456") where user="root";
刷新权限:flush privileges;
关闭窗口,重新进入;
mysql里修改密码:
set password for root@localhost = password('123456');