Dejan Levec

MySQL Add User

The simplest way to add user to MySQL and grant privileges for specific database.

1. Open terminal and type “mysql -u root -p” to start MySQL client and use your root account to connect to database.

2. Type “create database my_database;” to create a database with name my_database.

3. Type:

GRANT ALL PRIVILEGES
ON my_database.*
TO ‘my_user’@’localhost’
IDENTIFIED BY ‘my_password’
WITH GRANT OPTION;

With this command you’ve created a user with name my_user and password my_password with all privileges on my_database.

Leave a Reply

Your email address will not be published. Required fields are marked *