Reference link http://blog.csdn.net/leili0806/article/details/8573636, thank you for this guy. 1. Create a new user's SQL statement:
CREATE USER ' pig ' @ ' 192.168.1.101_ ' idendified by ' 123456 ';
Pig is the user name , followed by the specified IP( If no limit can be changed to "%" after a ip,@), by the password
2. Set permissions for this user, using the GRANT statement
( such as restricting a user to query only, cannot modify, or restrict to query only specific tables )
Grammar:
mysql> Grant permissions 1, permissions 2,... Permission n on the database name . Table name to User name @ user address identified by ' connection password ';
Optional list of permissions:Select, INSERT, UPDATE, delete, create, drop,
Index, alter, Grant, references, Reload,
shutdown, process, file , etc. 14 permissions
eg
1. mysql> Grant Select,insert,update,delete,create,drop on Vtdc.employee to [email protected] Identified by ' 123 ';
Assign user Joe from 10.163.225.87 to the employee table VTDC the database
Do the Select,insert,update,delete,create,drop, and set the password to 123.
2. mysql>grant all privileges in vtdc.* to [e-mail protected] identified by ' 123 ';
For users from 10.163.225.87, Joe assigns permissions to all operations on the database VTDC all tables, and sets the password to 123.
3. Mysql>grant All privileges on * * to [e-mail protected] identified by ' 123 ';
For users from 10.163.225.87, Joe assigns permissions to all the tables in all databases and sets the password to 123.
4. Mysql>grant All privileges on * * to [e-mail protected] identified by ' 123 ';
Assign the native user Joe permission to all operations on all tables in all databases, and set the password to 123.
5. Mysql>flush Privileges; //Refresh System Permissions Table
MySQL creates the user and specifies the user's permissions (Grant command)