mysql authorization and rights management rights management

authority management

 

1. Create a user

create user 'username' @ 'IP address' identified by' password '; # Syntax 
create user' username '@' localhost 'identified by' password '; # locally available accounts 
create user' user name'@'192.168.12.1 'identified by' password '; # ip available which specific accounts 
create user' username '@' 192.168.12% 'identified by ' password '; # which specific segments of available accounts 
create user' username '@'% ' identified by 'password'; # ip are available to all accounts

2, delete users

drop user 'username' @ 'IP address';

3, modify the user

rename user 'username' @ 'IP address' to 'new user name' @ 'IP address';

4, change passwords

set password for 'username' @ 'IP address' = password ( 'new password');

5. Authorization

grant permissions on the database tables to 'user' @ 'IP address' # authorization grammar. 

grant select on db1 * to' Zekai '@'% ';. All tables grant select permissions # db1 
grant select on * * to' Zekai. '@'% '; # all databases to grant permissions to select 
grant select, insert on * * to .' zekai '@'% '; # granting more rights 
grant all privileges on * * to. ' zekai '@'% ' ; # granting full rights, in addition to creating a user

6, creation and joint use of the authorization

grant all privileges on *.* to "账号名"@"%" identified by "密码" with grant option;

note:

  After each finished authorization, be sure to refresh authorization

flush privileges;

1. Create a user

create user 'username' @ 'IP address' identified by' password '; # Syntax 
create user' username '@' localhost 'identified by' password '; # locally available accounts 
create user' user name'@'192.168.12.1 'identified by' password '; # ip available which specific accounts 
create user' username '@' 192.168.12% 'identified by ' password '; # which specific segments of available accounts 
create user' username '@'% ' identified by 'password'; # ip are available to all accounts

2, delete users

drop user 'username' @ 'IP address';

3, modify the user

rename user 'username' @ 'IP address' to 'new user name' @ 'IP address';

4, change passwords

set password for 'username' @ 'IP address' = password ( 'new password');

5. Authorization

grant permissions on the database tables to 'user' @ 'IP address' # authorization grammar. 

grant select on db1 * to' Zekai '@'% ';. All tables grant select permissions # db1 
grant select on * * to' Zekai. '@'% '; # all databases to grant permissions to select 
grant select, insert on * * to .' zekai '@'% '; # granting more rights 
grant all privileges on * * to. ' zekai '@'% ' ; # granting full rights, in addition to creating a user

6, creation and joint use of the authorization

grant all privileges on *.* to "账号名"@"%" identified by "密码" with grant option;

note:

  After each finished authorization, be sure to refresh authorization

flush privileges;

Guess you like

Origin www.cnblogs.com/huikejie/p/11112178.html