It may be that the IP address is not set.
Problem: the MySQL permission is set correctly, but remote access is still unavailable. Port 3306 is not opened through telnet.
Analysis: by default, MySQL only binds 127.0.0.1, that is, port 3306 can be accessed only on the local machine.
Solution: Find the MySQL configuration file, search for "bind-address", and find this line:
Bind-address = 127.0.0.1 Add a # in front, comment out this line, save, and restart MySQL. Then you can use remote access. telnet can find that the port is also opened.
For example, we configure
1. Make sure that the skip-networking is deleted or blocked. Otherwise, TCP/IP access is not supported.
2. Add bind-address = 65.55.55.2 to replace 65.55.55.2 with your server address.
After modification, the configuration is as follows:
Copy codeThe Code is as follows:
[Mysqld]
User = mysql
Pid-file =/var/run/mysqld. pid
Socket =/var/run/mysqld. sock
Port = 3306
Basedir =/usr
Datadir =/var/lib/mysql
Tmpdir =/tmp
Language =/usr/share/mysql/English
Bind-address = 65.55.55.2
# Skip-networking
....
..
Save and close the configuration file
Restart the mysql server: #/etc/init. d/mysql restart
If the above method is not used, we can set it in general mysql command mode.
1. Change the table.
It may be that your account is not allowed to log on remotely, but only on localhost. At this time, you only need to log in to mysql on the computer of localhost, and change the "host" entry in the "user" table in the "mysql" database to "%" from "localhost"
Copy codeThe Code is as follows:
CODE: mysql-u root-p123
Mysql> use mysql;
Mysql> update user set host = '%' where user = 'root ';
Mysql> select host, user from user;
2. Authorization method.
For example, if you want kevin to use mypassword to connect to the mysql server from any host.
Copy codeThe Code is as follows: grant all privileges on *. * TO 'kevin '@' % 'identified BY 'mypassword' with grant option;
If you want to allow user kevin to connect to the mysql server from a host with ip address 192.168.101.234, and use mypassword as the password
Copy codeThe Code is as follows:
Grant all privileges on *. * TO 'kevin '@ '192. 168.101.234' identified by 'mypassword' with grant option;
Note that it is also important for a linux system firewall.
Copy codeThe Code is as follows:
/* Disable the firewall */
Service iptables stop
/* Enable Firewall */
Service iptables start
/* Disable the firewall by default */
Chkconfig iptables off