O'Reilly logo

Sams Teach Yourself MySQL by Chris Newman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

User Management

In this section, you learn how to manage user accounts and grant and revoke privileges.

Creating a User

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.

Passwords

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required