Set mysql to allow external access to the root account of mysql. I usually use localhost or 127.0.0.1 during connection. The mysql on the company's test server is also localhost, so the solution for www.2cto.com 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. www.2cto.com 2, authorized user. You want to use the root password to connect to the mysql server from any host to 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;