The following describes two methods to enable remote logon for quick mysql. For details, refer to the following.
The following describes two methods to enable remote logon for quick mysql. For details, refer to the following.
The Code is as follows: |
|
Mysql-u root-p Mysql> use mysql; Mysql> grant all privileges on *. * to root @ '%' identified by "root "; Mysql> select host, user, password from user; + ----- + -- + --------------- + | Host | user | password | + ----- + -- + --------------- + | Localhost | root | * 81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | | 192.168.1.12 | root | * 81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | | % | Root | * 81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | + ----- + -- + --------------- + 3 rows in set (0.00 sec) Mysql> flush privileges; |
Authorization law:
For example, if you want myuser to use mypassword to connect to the mysql server from any host.
The Code is as follows: |
|
Mysql> grant all privileges on *. * to identified by 'mypassword' with grant option; |
If you want to allow myuser to connect to the mysql server from a host whose ip address is 192.168.1.6, and use mypassword as the password
The Code is as follows: |
|
Mysql> grant all privileges on *. * TO 'myuser' @ '192. 168.1.3 'identified by 'mypassword' with grant option; |
Note:
1. Format: grant permission on database name. Table name to user @ login host identified by "User Password ";
2. Add ROOT instead of modification. If you change localhost to %, you cannot connect to mysql through localhost;
3. Refresh the MySQL system permission table flush privileges;
For more information about enabling mysql remote connection, see: http://www.111cn.net/database/mysql/34989.htm