1. New Users
The code is as follows:
Mysql>insert into Mysql.user (Host,user,password) VALUES ("localhost", "Lionbule", Password ("hello1234"));
Mysql>flush privileges;
2. Modify User Password
The code is as follows:
Mysql>update Mysql.user Set Password=password (' New password ') where user= "Lionbule" and host= "localhost";
Mysql>flush privileges;
3. Delete a user
The code is as follows:
Mysql>delete from user WHERE user= "lionbule" and host= "localhost";
Mysql>flush privileges;
4. Permission Assignment
4.1. Grant Usage
Grant permissions on the database. * to User name @ ' login host ' identified by ' password '
The code is as follows:
Permissions:
General Summary, All/alter/create/drop/select/update/delete
Database:
*. * represents all tables for all libraries
Test.* represents all tables of the test library
Test.test_table represents the Test_table table for the test library
User name:
MySQL account name
Login Host:
Allow client IP to log in to MySQL server
'% ' means all IP
' localhost ' indicates that the machine
' 192.168.10.2 ' specific IP
Password:
Login password for Account
4.2 Examples
The code is as follows:
Mysql>grant all on test.* to [e-mail protected] '% ' identified by ' hello1234 ';
Mysql>flush privileges;
The new password for ' hello234 ' user Lionbule has all the permissions on the test library and does not restrict the Lionbule user's login IP.
4.3 precautions
Grant overwrites some of the user's information with the INSERT and update execution functions.
MySQL Common operations