django执行迁移生成表
python manage.py migrate
报错
raise MigrationSchemaMissing("Unable to create the django_migrations table (%s)" % exc)
原因:Django2.1不再支持MySQL5.5,必须5.6版本以上
解决方法:
1.对django降级
2.对mysql升级
mysql升级:
(1)升级之前,最好将数据库的数据备份一下
mysqldump -uroot -p'jianshu.com' --all-databases > all_databases.sql
(2)下载源配置(ubuntu用apt-get来完成升级)
wget https://dev.mysql.com/get/mysql-apt-config_0.8.1-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.1-1_all.deb
会弹出弹窗选择
(3)更新
sudo apt-get update
(4)安装
sudo apt-get install mysql-server
(5)升级
sudo mysql_upgrade -u root -p
注:升级时可能会报错
Error: Failed while fetching Server version! Could be due to unauthorized access
依网上方法,依然不能upgrade成功
chown -R mysql /var/lib/mysql
mysql_upgrade -u root -p
然后试了一下直接进入mysql:
mysql -u root -p
竟然报错了:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/r
然后用了https://blog.csdn.net/heatdeath/article/details/78907563第一种方法就解决了
1.#ps -A|grep mysql
显示类似:
1829 ? 00:00:00 mysqld_safe
1876 ? 00:00:31 mysqld
2.#kill -9 1829
3.#kill -9 1876
4.#/etc/init.d/mysql restart
5.#mysql -u root -p
再次,升级:
sudo mysql_upgrade -u root -p
成功!
查看mysql版本
mysql --version