The following content is excerpted from [1 ~ 2]
1. Set the permissions to access a single database
Mysql> grant all privileges on test. * To 'root' @ '% ';
Note: The user name is set to root, and the password is blank. You can access the database test.
2. Set the access permission for the specified user name
Mysql> grant all privileges on *. * To 'liuhui' @ '% ';
Note: Set the specified user name to liuhui and the password to be blank to allow access to all databases *
3. Set password access permissions
Mysql> grant all privileges on *. * To 'liuhui' @ '%' identified by 'liuhui ';
Note: Set the specified user name to liuhui and the password to liuhui to access all databases *
4. Set the specified accessible host Permissions
Mysql> grant all privileges on *. * To 'liuhui' @ '10. 2.1.11 ';
Note: Set the specified user name to liuhui to access all databases. * only the machine 10.2.1.11 has the permission to access the database.
Original article:
[1] enabling MySQL Database Remote Access Permissions
Http://www.111cn.net/database/mysql/41034.htm
Http://bbs.linuxpk.com/thread-35260-1-1.html