1. Command: create user 'username' @ 'host' identified by 'Password ';
Description: username-the username you will create, host-specifies the host on which the user can log on. If a local user can use localhost, if you want to allow the user to log on from any remote host, you can use the wildcard %. password-the user's login password. The password can be blank. If it is blank, the user can log on to the server without the password.
Example: 1. create user 'dog '@ 'localhost' identified by '123 ';
2.Create user 'he 'identified by 'hes'; (this is what I use ).
2. Authorization.
command: grant privileges on databasename. tablename to 'username' @ 'host'
Note: privileges-user operation permissions, such as select, insert, update, etc. 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 *. *.
1. Grant select, insert on test. User to 'pig' @ '% ';
2. Grant all on *. * To 'pig' @ '% ';
3. Grant all privileges on *. * To username @ localhost identified
By 'Password ';