Turn on MySQL remote settings
1. Log in to MySQL
2. Create a user to connect remotely
mysql> use MySQL;
Mysql> GRANT All privileges on * * to ' root ' @ '% ' identified by ' 123456 ' with GRANT OPTION;
mysql> flush Privileges;
#root表示用户名;% indicates that all computers can be connected or set an IP address to run; 123456 is the root password
3. View the connection
Mysql>select host,user from user;
+-----------+------+
| Host | user |
+-----------+------+
| % | Root | #主要要有这个
| 127.0.0.1 | Root |
| Linux | |
| Linux | Root |
| localhost | |
+-----------+------+
5 rows in Set (0.00 sec)
or SELECT DISTINCT CONCAT (' User: ', user, ' @ ', host, '; ') as query from Mysql.user;
4. Then open nano/etc/mysql/my.cnf
Set bind-address = 127.0.0.1 to bind-address = 0.0.0.0 # (device address)
5. Restart MySQL service MySQL restart
6, if there is a firewall, service iptables stop//temporarily shut down, can also be modified through the configuration file open 3306
Linux Open MySQL remote connection