1. Create a new user.
//log in to MySQL
@>mysql-u root-p
@> Password
//Create user
mysql> INSERT INTO Mysql.user (Host,user,password) VALUES ("localhost", "abc", Password ("1234"));
//Refresh System Permissions Table
Mysql>flush privileges;
This creates a user named: The ABC password is: 1234.
then log in.
mysql>exit;
@>mysql-u abc-p
@> Enter Password
mysql> Login Successful
2. Authorize the user.
//log in to MySQL (with root access). I am logged in as root.
@>mysql-u root-p
@> Password
//First create a database for the user (test2)
mysql>create database test2;
//Authorize the ABC user to have all permissions for the Test2 database. (and all IP can be logged in, note: my.cnf to comment point bindress=127.0.0.1)
>grant all privileges in test2.* to ' abc ' @ ' percent ' identified by ' 1234 ';
//Refresh System Permissions Table
Mysql>flush privileges;
mysql> Other Operations
/*
If you want to specify partial permissions to a user, you can write:
mysql>grant select,update on test2.* to ' abc ' @ ' percent ' identified by ' 1234 ';
//Refresh the System permissions table.
Mysql>flush privileges;
*/
3. Delete the user.
@>mysql-u root-p
@> Password
mysql>delete from user WHERE user= "abc" and host= "localhost";
Mysql>flush privileges;
//Delete a user's database
mysql>drop database test2;
4. Modify the specified user password.
@>mysql-u root-p
@> Password
mysql>update Mysql.user Set Password=password (' New password ') where user= "abc" and host= "localhost";
Mysql>flush privileges;
Recommendation: Welcome to Exchange, put forward some guidance and suggestions
MySQL create user and authorize