Mysql is used in the recording project. During the test today, we found that the mysql database cannot be remotely connected. It turns out that mysql does not allow remote connection by default.
After searching, we found a solution and recorded it for future reference.
(1) At first, I used the root user to remotely connect to the mysql server ip address and reported an error:
[root@chu Record]# mysql --host=192.168.110.68 --user=root --passwordEnter password: ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.110.68' (111)
It turns out to be
By default, Mysql only allows local login, so you need to modify the configuration file to bind the address to comment out:
Vim/etc/mysql/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 <--- comment out this line and you can log on remotely.
See http://blog.sina.com.cn/s/blog_60fcb5a10100qkyb.html
(2) continue to report the following errors after modification:
1 [root@chu Record]# mysql --host=192.168.110.68 --user=root --password
2 Enter password:
3 ERROR 1130 (HY000): Host '192.168.56.123' is not allowed to connect to this MySQL server
If you want to allow myuser to connect to the mysql server from a host whose ip address is 192.168.1.3, and use mypassword as the password
Grant all privileges on *. * TO 'myuser' @ '192. 168.1.3 'identified BY 'mypassword' with grant option;
See http://blog.csdn.net/rongjch/archive/2006/02/23/607124.aspx
After this operation, the problem is solved.