1. Actions for new user only
Mysql-u root-p Password
mysql> INSERT INTO Mysql.user (Host,user,password) VALUES (' localhost ', ' czc ', Password (' root '));
Mysql>flush privileges;
mysql>exit;
Mysql-uczc-proot
Mysql> Login Successful
2. Actions that are also authorized by the new user
Mysql-u root-p Password
Mysql>create database czc;
Grant all on czc.* to [email protected] identified by ' Root ';
Mysql>flush privileges;
Mysql> Other operations
Mysql>grant select,update on czc.* to [e-mail protected] identified by ' Root ';
Mysql>flush privileges;
Mysql> grant permissions 1, permissions 2,... Permission n on the database name. Table name to User name @ user address identified by ' connection password ';
Permissions 1, Permissions 2,... Permission n represents 14 permissions, such as Select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file.
When permissions 1, permissions 2,... Permission n is replaced by all privileges or all to give the user full permission.
When the database name. The table name is replaced by *. *, which indicates that the user is given permission to manipulate all tables on the server.
The user address can be localhost, or it can be an IP address, a machine name, and a domain name. You can also use '% ' to indicate connections from any address.
' Connection password ' cannot be empty, otherwise the creation failed.
3. Delete a user
Mysql-u root-p Password
Mysql>delete from user WHERE user= ' czc ' and host= "localhost";
Mysql>flush privileges;
Mysql>drop database czc;
4. Modify the specified user password
Mysql-u root-p Password
Mysql>update Mysql.user Set Password=password (' New password ') where user= ' Czc ' and host= ' localhost ';
Mysql>flush privileges;
mysql>quit;
MySQL user-side operations