How to create a New Database-user and Grand Permissions – MySQL

Enter the mysql prompt by following the step below:

# mysql -u root -p

It then prompts for password. Enter the MySQL root password.

root@server [/]# mysql -u root -p
Enter password:

Command to Grand All privileges on DB for a user.

mysql> GRANT ALL PRIVILEGES ON database.* to 'username'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;

how to add SELECT privileges to a user using GRANT.

mysql> GRANT SELECT ON database.* to 'username'@'localhost' IDENTIFIED BY 'password';

how to add a selection of privileges to a user using GRANT.

mysql> GRANT SELECT, INSERT, DELETE ON database.* to 'username'@'localhost' IDENTIFIED BY 'password';

Related posts

Latest posts

Leave a Comment

Leave a Reply

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