Set mysql to allow Internet access
By default, root does not support remote logon. What permissions do you have to grant to connect to the Internet? Grant all privileges on *. * TO 'username' @ '%' identified by 'Password' with grant option; create a remote Logon account and GRANT it the permission TO log ON remotely.
The root account of mysql. I usually use localhost or 127.0.0.1 during connection. The mysql on the testing server of the company is also localhost. Therefore, I want to access the root account and the test is paused.
The solution is as follows:
1. Modify the table, log on to the mysql database, switch to the mysql database, and use the SQL statement to view "select host, user from user;" mysql-u root-pvmwaremysql> use mysql; mysql> update user set host = '%' where user = 'root'; mysql> select host, user from user; mysql> flush privileges; Note: The last sentence is very important, the purpose is to make the modification take effect. if no data is written, remote connection is still unavailable.
2. Authorize the user. You want the root user to use the password to connect to the mysql server from any host. grant all privileges on *. * TO 'root' @ '%' identified by 'admin123' with grant option; flush privileges; if you want to allow the user root to connect to the mysql server from the host with the ip address 192.168.1.104, grant all privileges on *. * TO 'myuser' @ '192. 168.1.104 'identified BY 'admin123' with grant option; flush privileges;
Access the mysql database through the vro Internet
1. The following conditions are met:
Public IP addresses, whether dynamic or static, are better dynamic. If you are in trouble, you can use DDNS services such as peanut shells.
2. open ports
Whether you are connecting to a route or connecting to a dial-up route, you need to perform port 3306 ing in the router. the dial-up bandwidth must allow port 3306 access in the firewall. You can use the telnet command to test.
3. MYSQL user permissions (important here)
When MYSQL is installed as ROOT, only the local access permission is granted by default. localhost can be changed to remote Installation during installation. The last step is to check the option box. This is for WINDOWS. If it is for LINUX command plus permission
If you create a new user, you must have % remote permissions.
4 Test
Test mysql-h (IP address)-u username-p (password) in the built-in command line and press enter if mysql>