mysql连接报错:ERROR 2002 (HY000):Can't connect to

2019-11-14 09:15发布

问题:

使用MySQL客户端连接远程amoeba进行远程控制数据库报错:

root@uduntu:~# mysql -u root -P8066  -h 172.18.0.4 -p
Enter password: 
ERROR 2002 (HY000): Can't connect to MySQL server on '172.18.0.4' (115)

求解答????在线等谢谢,可进行远程协调

回答1:

Maybe the root is not allowed to connect mysql server from a remoting host. I advise you to create a new user instead of root.

create user 'joey'@'%' identified by 'yourpassword';
grant all privileges on yourdb.* to 'joey'@'%'

you can replace '%' with your host(if not, connecting mysql server from every remoting host is allowed)



回答2:

要检查下 mysql服务是否开了远程权限