Last active
July 31, 2022 18:26
-
-
Save rwp0/f68c013a4c25cb72816869180e95a57f to your computer and use it in GitHub Desktop.
MySQL create database user and grants privileges with a single command
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
-- create database user and grant privileges with a single command | |
GRANT ALL PRIVILEGES | |
ON TABLE <database>.* | |
TO <user> | |
IDENTIFIED BY <password>; | |
SHOW GRANTS FOR <user>; | |
-- output: GRANT ALL PRIVILEGES ON `<database>`.* TO '<user>'@'%' | |
-- % is the default host for the user (ie. IP address or hostname where the user connects from) | |
-- OR: | |
-- CREATE USER <user> IDENTIFIED BY <password>; | |
-- GRANT ALL PRIVILEGES ON <database>.* TO '<user>'@'%'; | |
-- qv. https://dev.mysql.com/doc/refman/5.6/en/grant.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment