-
-
Save aisensiy/47ebb36f87f08b6f750ba600a283e2c0 to your computer and use it in GitHub Desktop.
Create read only mysql database user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Login | |
$ mysql -u root -p | |
# Check privileges | |
$ SHOW GRANTS FOR 'read-only_user_name'@'%'; | |
# Remove the privileges if any | |
$ REVOKE ALL PRIVILEGES ON database_name.* FROM 'read-only_user_name'@'%'; | |
# Give the user access to the database from any host | |
$ GRANT SELECT ON database_name.* TO 'read-only_user_name'@'%' IDENTIFIED BY 'password'; | |
# Update privileges | |
$ FLUSH PRIVILEGES; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment