Environment: MySQL Sever 5.1 + MySQL command line tool
Issue: Create a user, authorize by using the command line
1. Create User:
Command: CREATE USER username identified by ' password ';
Description: username--You will create the username, password--the user's login password, the password can be empty, if it is empty then the user can not need a password login server.
Example:
CREATE USER WGB identified by ' WGB ';
2. Authorization:
Command: GRANT privileges on databasename.tablename to username;
Description: privileges--user's operation rights, such as SELECT, INSERT, UPDATE, etc., use all if you want to grant all permissions. databasename--database name, tablename--table name, which can be used if you want to give the user the appropriate action rights for all databases and tables, such as *.*.
Example:
GRANT SELECT, insert,update on Test.user to Wgv;
GRANT all on *.* to;
Note: Users authorized by the above command cannot authorize other users, and if they want the user to be authorized to do so, use the command:
Grant privileges Ondatabasename.tablename to with Grant OPTION;
Also refresh the System permissions table after authorization:
Flush privileges;
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/database/MySQL/