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.
Solution:
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 to make the modification take effect. If there is no write, remote connection is still not allowed.
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 a 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;