2003 -Can't connection to mysql server on | navicat for mysql Access denied for user 'root'@''ip'(using password :yes)

用本机windows上的Navicat for mysql链接虚拟机Linux的mysql数据库时,第一次连接的时候报的错误是

2003 -Can't connection to mysql server on '服务器ipAddress'(10038),这是由于端口没有开放,或者Linux的防火墙没有关闭,

解决办法:

1、在本地建立新的入站3306端口规则,找到防火墙->高级设置

点击入站规则

建立新的入站规则

选择端口

然后关闭Linux的防火墙,执行命令

service iptables stop

再次连接,报错是1045 -Access denied for user'root'@'ipAddress'(using password :yes)

 这是由于没有给用户授权

在Linux端进入mysql进行授权

mysql -u 用户名 -p
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY '密码' WITH GRANT OPTION;
FLUSH PRIVILEGES;

再次连接就ok了。

posted @ 2017-07-13 10:47  柠檬味的橘子皮  阅读(179)  评论(0编辑  收藏  举报