问题描述
在使用python manage.py inspectdb 命令根据数据库反向生成model.py时,发现对应的model.py的内容没有正确生成,记录的错误信息为
# Unable to inspect table 't_test_process_task_info'
# The error was: (1044, 'No access to the other database information_schema')
问题原因
经过分析和尝试,确定是因为django和mysql的版本不匹配造成的,经过多次尝试得出如下关系
django版本 | MySql 版本 |
---|---|
django 2.0 | MySql 5.5 - MySql 8.0 |
django 3.0 | MySql 8.0 |
解决方法
1、 Django降级到2.0 ,使用如下命令
pip install django==2.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
2、将MySql升级
将表中数据进行备份
从官网下载MySql 8.0 安装升级