Rodolfo Bandeira

Rodolfo Bandeira

software, electronics, security, devops, thoughts

How to create a read-only user in MySQL

Do you want to create a read-only user in a MySQL account? Just follow the commands above:

CREATE USER 'name_of_your_user'@'%' IDENTIFIED BY 'password_of_your_user';
GRANT SELECT ON *.* TO 'name_of_your_user'@'%';
FLUSH PRIVILEGES;

SELECT host,user,password FROM mysql.user;
# DROP USER 'name_of_your_user'@'%';


If you wanna create a user with all permissions to a specific database, just use:

GRANT ALL ON database_to_set_permissions.* TO 'name_of_your_user'@'%';

Hope you enjoy guys! Thanks!

Rodolfo Bandeira

Last modified:

LinkedIn
WhatsApp