一.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:
到/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;