There are three ways MySQL creates users: the SSC Web site, the INSERT user table method, the Create user method, and the Grant method. Enterprise: 217 1793 408
1. Create user by creating users command
Script: CREATE USER ' username ' @ ' host ' [Identified by ' PASSWORD '] where the password is optional;
Example: CREATE USER ' test ' @ ' 127.0.0.1 ' identified by "123";
CREATE USER ' Test ' @ ' 127.0.0.% ' identified by "123";
CREATE USER ' Test ' @ '% ';
Note: This method is created by the user only to connect to the database permissions, need to follow-up authorization;
2. Create a user with the grant command
Personal habits generally use this method to create a user, grant will authorize the user when the database exists, but when the database does not exist, the user will create
and authorized by the appropriate user. (indicates that the above step is superfluous)
Script:
GRANT <all|priv1,priv2,..... privn> on [object] [identified by ' Password ']
[with GRANT OPTION];
Max_queries_per_hour Count
Max_updates_per_hour Count
Max_connections_per_hour Count
Max_user_connections Count
Description: Priv represents permission Select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process, File, etc. 14 permissions
Example: Mysql>grant select,insert,update,delete,create,drop on test.hr to [e-mail protected] identified by ' 123 ';
Description: Assigns the user test of the host to 127.0.0.1 the ability to perform operations such as Select,insert,update,delete,create,drop on the HR table of the database test, and to set the password
To 123.
Mysql>grant all privileges on test.
to [e-mail protected] identified by ' 123 ';
Description: Assigns the user test of the host 127.0.0.1 to all operations on the database test all tables, and sets the password to 123.
Mysql>grant all Privileges on.
To [e- Mail protected] identified by ' 123 ';
Description: Assigns the user test to the host 127.0.0.1 the right to perform all operations on all tables in all databases and sets the password to 123.
Mysql>grant all Privileges on. * to [e-mail protected] identified by ' 123 ';
Description: User test assigns permissions to all operations on all tables in all databases and sets the password to 123.
MySQL Create user and SSC website build