Mysql>INSERT INTO Mysql.user (Host,user,password) VALUES ("localhost" ," Test ", Password (" 1234 "));added a username for test, password for 1234 users. However, the user can only log in locally, if you want to log on remotely, you can change the localhost to% to indicate that no matter what a computer can log on. Or a specific IP indicates that only a specific IP address can be logged on.
- To add permissions to a user
mysql>grant all privileges in testdb.* to [e-mail protected] identified by ' 1234 ';Indicates to the user that the test has added a local login to all tables of the TestDB database regardless of the operation. If you want to specify permissions. You can add allPrivileges modified to a combination of select or update or delete or three. If you want to specify the permissions of the table, you can change the testdb.* to Testdb.info to indicate that the info table in the TestDB database can be manipulated; If you want to specify an access address, you can change the @% to localhost to indicate that the user test can only perform local operations on the database.
- Refresh System Permissions Table
Mysql>flush privileges;
mysql>delete from user Where user= ' test ' and host= ' localhost ';
- Delete accounts and permissions
MySQL>drop User [email protected] '% ';
mysql>update Mysql.user Set Password=password (' New password ') where user= "test" and host= "localhost";
Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.
MySQL, add and remove users, add permissions