1. Add a user
Copy codeThe Code is as follows:
Mysql> insert into mysql. user (Host, User, Password) values ("localhost", "lionbule", password ("hello1234 "));
Mysql> flush privileges;
2. Change the User Password
Copy codeThe Code is as follows:
Mysql> update mysql. user set password = password ('new password') where User = "lionbule" and Host = "localhost ";
Mysql> flush privileges;
3. delete a user
Copy codeThe Code is 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 username @ 'login host' identified by 'Password'
Copy codeThe Code is as follows:
Permission:
Common Summary: ALL/ALTER/CREATE/DROP/SELECT/UPDATE/DELETE
Database:
*. * Indicates all tables in all databases.
Test. * indicates all tables in the test database.
Test. test_table indicates the test_table table of the test database.
User name:
Mysql account name
Login Host:
Client ip addresses allowed to log on to mysql server
'%' Indicates all ip addresses
'Localhost' indicates the Local Machine
'1970. 168.10.2 'specific IP Address
Password:
Logon password for the Account
4.2 Example
Copy codeThe Code is as follows:
Mysql> grant all on test. * to lionbule @ '%' identified by 'hello1234 ';
Mysql> flush privileges;
Lionbule, the user with the new password 'hello234', has all operation permissions on the test database and does not limit the logon IP address of lionbule users.
4.3 precautions
Grant overwrites some user information, which is the same as the insert and update operations.
Refer:
Http://dev.mysql.com/doc/refman/5.6/en/grant.html