ubuntu 下mysql不能进行远程连接

一.ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.x.x' (111)


到/etc/mysql/my.cnf文件中查看是否“bind-address           = 127.0.0.1”行被注释了


以下是my.cnf文件部分内容展示
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address           = 127.0.0.1


二.
Error Code: 1045
MySQL server uses client's login ('root' in your case) and the name of the client computer which it tries to set the connection from for the client authentication. In your case the reason is that your 'root' user from your client computer doesn't have permissions to access this MySQL server.


To solve this problem you should grant the necessary permissions to user root@<client_computer_name>.
You can do this with the help of User Manager tool of SQL Manager.


解决办法1:

mysql> grant all privileges on *.* to 'root'@'%' identified by 'your ppassword' with grant option;

%表示所以ip


解决办法2:
更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改成"%" 
mysql>use mysql; 
mysql>update user set host = '%' where user = 'root'; 
mysql>select host, user from user;
mysql>FLUSH PRIVILEGES;


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

北京橙溪 www.enwing.com

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值