当我使用命令“python manage.py makemigrations”(与输入“python manage.py runserver”相同)时,它抛出了这个错误。然后我检查了用户的权限。代码和结果如下所示。
mysql> select host,user from mysql.user;
+-----------+---------------+
| host | user |
+-----------+---------------+
| % | root |
| % | zhuxin |
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | root |
| localhost | zhuxin |
+-----------+---------------+
mysql> show grants for 'zhuxin'@'%';
+---------------------------------------------------------------+
| Grants for zhuxin@% |
+---------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'zhuxin'@'%' WITH GRANT OPTION |
| GRANT ALL PRIVILEGES ON `blogdb`.* TO 'zhuxin'@'%' |
+---------------------------------------------------------------+
mysql> show grants for 'root'@'%';
+--------------------------------------------------+
| Grants for root@% |
+--------------------------------------------------+
| GRANT USAGE ON *.* TO 'root'@'%' |
| GRANT ALL PRIVILEGES ON `blogdb`.* TO 'root'@'%' |
+--------------------------------------------------+
我已经尝试了一切办法来解决它,但都无济于事。