(1) Check whether MySQL 3306 is open to the outside world. By default, MySQL does not provide the external access function. The method is as follows:
1 ~ # Netstat-an | grep 3306
2 tcp 0 0 127.0.0.1: 3306 0.0.0.0: * LISTEN
It can be seen from the above that port 3306 of mysql only listens to local connections, which hinders access from the external IP address to the database. The modification method is actually very simple, enter the directory of the mysql configuration file (/etc/mysql/my. cnf), find the following content in the file:
1 # Instead of skip-networking the default is now to listen only on
2 # localhost which is more compatible and is not less secure.
3 bind-address = 127.0.0.1
Add a comment to bind-address (or change it to the IP address of the client host you want to use) (this is not successful ).
In this way, even if the mysql remote access port is enabled, another more important step is to authorize the remote user.
(2) check whether the client user has access permissions.
To grant the user access permission to the mysql client, we can authorize the user as follows:
1 mysql> grant all on *. * to user_name @ '%' identified by 'user _ password ';
2 # Or
3 mysql> grant all privileges on *. * to username @ "%" identified by "password"; # (this sentence is accurate)
4 # Or
5 create user 'test' @ '125.76.229.113 'identified by '123 ';
6 create user 'test' @ '125.76.229.215 'identified by '123 ';
7 create user 'test' @ '60.195.252.106 'identified by '123 ';
The user permissions granted by the preceding command can access any database and table in mysql ).
After completing the above two steps, restart mysql to remotely log on to the mysql server. The Mysql restart command is as follows:
View the source code print help 1 sudo/etc/init. d/mysql restart