MySQL remote access permission, allow enabling remote connection 1. log on to mysql Database mysql-u root-p to view the user table www.2cto.com mysql> use mysql; Database changedmysql> select host, user, password from user; + ---------------- + ------ + --------------------------------------- + | host | user | password | + -------------- + ------ + host + | localhost | root | * Users | 192.168.1.1 | root | * A731 Users | + -------------- + ------ + ------------------------------------------- + 2 rows in set (0.00 sec) can see the root user created in the user table. The host field indicates the Host to log on to. The value can be an IP address or a host name. (1) If you want to log on with a local IP address, you can change the Host value to your own Ip address.
2. implement remote connection (authorization). Changing the host field value to % indicates that the root user can log on to the mysql server on any client machine. We recommend that you set the value to % during development. Update user set host = '%' where user = 'root'; change the permission to ALL PRIVILEGESmysql> use mysql; Database changedmysql> grant all privileges on *. * to root @ '%' identified by "root"; Query OK, 0 rows affected (0.00 sec) www.2cto.com mysql> select host, user, password from user; + -------------- + ------ + --------------------------------------- + | host | user | password | + ---------------- + ------ + host + | localhost | root | * host | 192.168.1.1 | root | * host | % | root | * A731AEBFB621E354CD41BAF207D884A609E81F5E | + ---------------- + ------ + ----------------------------------------- + 3 rows in set (0.00 sec) in this way, the machine can remotely access MySql.3 on the machine with the username, root password, and root password to achieve remote connection (change the table method) use mysql; update user set host = '%' where user = 'root'; in this way, the remote user can access Mysql through the root user. author XL. liang