One, create the user:
Command: CREATE user ' username ' @ ' host ' identified by ' password '; (host– specifies on which host the user can log on, if localhost is available for local users, If you want the user to be able to log in from any remote host, you can use the wildcard character%;p Assword can be empty)
Select DISTINCT CONCAT (' User: ', user, ' ' @ ', host, '; ') as query from Mysql.user; (View user)
Second, Authorization:
Command: GRANT privileges on databasename.tablename to ' username ' @ ' host ';
GRANT all on * * to ' user ' @ '% ';
Three. Set and change user password:
Command: SET PASSWORD for ' username ' @ ' host ' = PASSWORD (' NewPassword ');
If it is the current login user with Set PASSWORD = PASSWORD ("NewPassword");
Four. Revoke user rights:
Command: REVOKE privilege on databasename.tablename from ' username ' @ ' host ';
MySQL User management