How to add a new user to your MySQL tutorial database tutorial
This article is mainly about how to add new users to your MySQL database oh, because a MySQL may have a lot of databases we want to give each different database open permissions, open the user, this is necessary.
Create user user [identified by [password] ' password ']
Instance
Create user ' user1 ' @ ' localhost ' identified by ' pass1 ';
If you check the Mysql.user table, you can find a new record in it. Please note that all priviliges are loaded so this user can have a database independent number. To add some preiviliges we can use the grant command as follows
Grant Select,insert,update,delete on *.* to ' user1 ' @ ' localhost ';
We have only added the most important priviliges to the user, but the table cannot be created above,
Grant all on *.* to ' user1 ' @ ' localhost ';
Grant all on *.* to ' user2 ' @ ' localhost ' identified by ' pass1 ';
You can save data to a table
Insert into User (Host,user,password) values (' localhost ', ' User3 ', password (' PASS3 '));