In this section, you learn how to manage user accounts and grant and revoke privileges.
Use the CREATE USER command to create a new user. The username given should be a username and a host, in the format user@host. Include the keywords IDENTIFIED BY to set a password for the new user.
If you do not assign a password for a user, that user will be able to connect to MySQL without even supplying a password.
The following example creates a new user named chris that can connect only from localhost, with the password mypass:
mysql> CREATE USER chris@localhost IDENTIFIED BY 'mypass'; Query OK, 0 rows affected ...