1. New Users
Copy Code code as follows:
Mysql>insert into Mysql.user (Host,user,password) VALUES ("localhost", "Lionbule", Password ("hello1234"));
Mysql>flush privileges;
2. Modify User Password
Copy Code code as follows:
Mysql>update Mysql.user Set Password=password (' New password ') where user= "Lionbule" and host= "localhost";
Mysql>flush privileges;
3. Delete User
Copy Code code as follows:
Mysql>delete from user WHERE user= "lionbule" and host= "localhost";
Mysql>flush privileges;
4. Permission Assignment
4.1. Grant Usage
Grant permission on database. * To User name @ ' login host ' identified by ' password '
Copy Code code as follows:
Permissions:
Common Summary, All/alter/create/drop/select/update/delete
Database:
*.* represents all tables for all libraries
Test.* represents all tables of the test library
Test.test_table represents the Test_table table of the test library
User name:
MySQL account name
Login Host:
Allow client IP to log on to MySQL server
'% ' means all IP
' localhost ' means this machine
' 192.168.10.2 ' specific IP
Password:
Account corresponding Login password
4.2 Examples
Copy Code code as follows:
Mysql>grant all in test.* to lionbule@ '% ' identified by ' hello1234 ';
Mysql>flush privileges;
The new password is ' hello234 ' user lionbule has all the operation rights to the test library, does not restrict the Lionbule user's Landing IP.
4.3 points to note
Grant overwrites some of the user's information, as it does with the INSERT and update functions.
Reference:
Http://dev.mysql.com/doc/refman/5.6/en/grant.html