Create a MySQL database user

October 20, 2013 | Last tested: May 2015 | 731 views | Comments

Create a user to access a MySQL database to add, edit, delete, and list records.

For example.

Create a MySQL user from the terminal.

Access the MySQL database first, and execute the code below once inside the MySQL monitor.

CREATE USER 'USERNAME'@'HOST' IDENTIFIED BY 'PASSWORD';

Where:

  1. USERNAME = the name of the user who will have access to the database.
  2. HOST = the server where the user will be allowed to log in, usually LOCALHOST, it can be an ip address.
  3. PASSWORD = the password of the user.