这是因为自己本地开发环境电脑的IP地址,并没有赋予访问服务器端mysql数据库的权限。
解决办法:
**
方法一:
**
1.在服务器mysq中运行下面命令:
use mysql;
create user 'root'@'IP地址' identified by '密码';
update user set Password ="密码" where Host="IP地址" and User="root";
grant all privileges on *.* to root@'IP地址';
2.查看数据库mysql中user表中Host字段为‘IP地址’的这一行的密码
use mysql;
select Host,Password from user where Host="IP地址";
结果如下:
±-------------±-----±------------------------------------------+
| Host | User | Password |
±-------------±-----±------------------------------------------+
| IP地址 | root | 密码 |
±-------------±-----±------------------------------------------+
3.再次用navicat练级数据库即可。
转载自:https://www.cnblogs.com/lizhihui/articles/5490217.html
**
方法二:
**
1、SSH登录root管理员账户
2、登录MySql
# mysql -u root -p
Enter password:
(3)执行授权命令
mysql> grant all privileges on *.* to root@'localhost' identified by '密码';
mysql> flush privileges;
或
mysql> grant all privileges on *.* to root@'%' identified by '密码';
mysql> flush privileges;
(4)退出再试
mysql> quit
Bye
原文链接:https://blog.csdn.net/lhl1124281072/article/details/80277163