此报错的原因则是没有开通权限
解决方案:
1、打开cmd命令面板
2、输入mysql -u root -p
,之后输入密码(数据库root账户的密码)
3、开通权限
全部开放
GRANT ALL PRIVILEGES ON . TO ‘root’@‘%’ IDENTIFIED BY ‘password’ WITH GRANT OPTION;
指定ip开放
GRANT ALL PRIVILEGES ON . TO ‘root’@‘192.168.12.1’ IDENTIFIED BY ‘password’ WITH GRANT OPTION;
刷新权限flush privileges;
5、重启MySQLnet stop mysql
,net start mysql
来源地址:https://blog.csdn.net/lhkuxia/article/details/128774797