Environment: MySQLSever5.1MySQL command line tool problem: use command line to create a user and authorize 1. create a user: Command: CREATEUSERusernameIDENTIFIEDBYpassword; Description: username -- the user name you will create, password -- the user's login password. The password can be blank.
Environment: MySQL Sever 5.1 MySQL command line tool problem: use command line to create a user and authorize 1. create user: Command: create user username identified by 'Password'; Description: username -- the username you will CREATE, password -- the USER's login password. The password can be blank, if it is null, the user can
Environment: MySQL Sever 5.1 + MySQL command line tool
Problem: Use command lines to create and authorize users
1. Create a user:
Command:Create user username identified by 'Password ';
Description: username -- the username you will create, password -- the login password of the user. The password can be blank. If it is blank, the user can log on to the server without a password.
Example:
CREATE USER wgb IDENTIFIED BY ‘wgb’;
2. Authorization:
Command:GRANT privileges ON databasename. tablename TO username;
Note: privileges-user operation permissions, such as SELECT, INSERT, and UPDATE. If you want to grant ALL permissions, use ALL .; databasename -- Database Name; tablename -- table name. If you want to grant the user the corresponding operation permissions on all databases and tables, it can be represented by *, as shown in *. *.
Example:
GRANT SELECT, INSERT,UPDATE ON test.user TO wgv;GRANT ALL ON *.* TO ;
Note: The user authorized with the preceding command cannot authorize other users. to authorize the user, run the following command:
GRANT privileges ONdatabasename. tablename to with grant option;
After authorization, you must refresh the system permission table:
flush privileges;
References:
MySQL user creation and authorization
MySql creates a user, creates a database, authorizes a user, deletes a user, and modifies a password.
How to create a user and a database in MySql