Mysql adds and deletes users and assigns bitsCN.com permissions.
1. add a user
Mysql> insert into mysql. user (Host, User, Password) values ("localhost", "lionbule", password ("hello1234 "));
Mysql> flush privileges;
2. change the user password
Mysql> update mysql. user set password = password ('New password') where User = "lionbule" and Host = "localhost ";
Mysql> flush privileges;
3. delete a user
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'
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
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
BitsCN.com