MySQL database of DCL (Data Control Language)

1. MySQL root access to the DCL set ip specified

Enter mysql: mysql -uroot -p or mysql -uroot -h127.0.0.1 -p (host default is 127.0.0.1)

mysql> use mysql; 

mysql> update user set host = 'ip' where user = 'root'; 

mysql> select host, user from user; 

mysql> flush privileges;

2.MySQL of DCL change your password and forgot the password to solve

MySQL8.0 change the password problem : Use alter user to modify password MySQL8.0, because MySQL8.0 after encryption is caching_sha2_password, if you use update to modify settings authentication_string password field will give the user table in the root user newpassowrd value, when re-using the alter user 'root' @ 'localhost ' identified by 'newpassword' it would have been an error when you modify the password must be emptied and then modified, because the next authentication_string field only after 43 MySQL encrypted password string, others will report wrong format, they are able to change the password at a later MySQL8.0 method only: ALTER USER 'root' @ ' localhost' IDENTIFIED WITH mysql_native_password BY ' your password';

MySQL8.0.12 reset the root password

3.MySQL the DCL regular user authorization and permission to create recovery

Generally, a program corresponding to a database; 

(1) Create a user

create user username @ 'IP address' identified by 'password';

Note: This user can only use all IP% use in the formulation of IP.

(2) user authorization

1 grant permission, permission 2, ...... on the database name. * to address or username @IP%

Note: All database to use * * All rights to use all or all privileges.

(3) revoke privileges

1 revoke privileges, rights 2, ...... on the database name. * from @IP address or username%

 DCL 4.MySQL the user permission to view and delete users

(1) View Permissions

show grants for username @IP address;

(2) Delete User

drop user username @IP address;

 

Guess you like

Origin www.cnblogs.com/yuehouse/p/11184399.html