Allow access to MYSQL database for a specific user only

To grant full permissions :

mysql> grant all privileges on database_name.* to 'username'@'localhost';

Query OK, 0 rows affected (0.09 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.09 sec)

mysql -uusername -p

mysql> show databases...

To Revoke all permissions :

mysql> REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'username'@'localhost';

Leave a Reply