Studying Note 2 of MySQL - User Account Manager

xiaoxiao2021-03-06  14

1.Add a New User.

GRANT:

MySQL> Grant Privileges on Database.table To

'User' @ 'host' identified by 'Prassword'

Such as

MySQL> grant all privileges on *. * to

'yangsf' @ 'localhost' identified by '9851326' with grant option;

MySQL> grant all privileges on *. * to

'yangsf' @ '%' Identified by '9851326' with grant Option;

Mysql> Grant SELECT, INSERT, DELETE, UPDATE, CREATE, DROP ON Spirent. * To

'xiaoli' @ '%' Identified by '9851326';

Mysql> Grant Reload, Process on *. * to

'yangsf' @ 'localhost' identified by '9851326';

Mysql> grant usage on *. * to

'xiaozhang' @ 'localhost';

INSERT:

Such as

Mysql> Insert INTO User (Host, User, Password) Values ​​('localhost', 'xiaozhang', '');

mysql> flush privileges;

2.Delete a user;

MySQL> Drop user user [, user] ....

Such as

Mysql> Drop user 'xiaozhang' @ 'localhost';

3.Modify The Account Password.

Shell> msqladmin -u user_name -h host_name password 'newpassword'

oral

Mysql> Set Password for

'User_name' @ 'host_name' = password ('newpassord');

oral

MySQL> Update User Set Password = password ('newpassord') where host = 'host_name' and user = 'user_name';

oral

Mysql> grant usage on *. * to

'user_name' @ 'host_name' identified by 'newpassword';

转载请注明原文地址:https://www.9cbs.com/read-67813.html

New Post(0)