Last active
March 9, 2017 19:54
-
-
Save aamnah/3ac85de26de9a8b5bf68b8ecd08b42e1 to your computer and use it in GitHub Desktop.
MySQL: Create a database, user, and grant privileges
This file contains hidden or 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
| SET @DATABASE='database'; | |
| SET @USERNAME='username'; | |
| SET @PASSWORD='password'; | |
| SET @HOST='localhost'; | |
| CREATE DATABASE @DATABASE; | |
| CREATE USER '@USERNAME'@'@HOST' IDENTIFIED BY '@PASSWORD'; | |
| -- GRANT USAGE ON @DATABASE.* TO '@USERNAME'@'@HOST'; | |
| GRANT ALL PRIVILEGES ON @DATABASE.* TO '@USERNAME'@'@HOST'; | |
| FLUSH PRIVILEGES; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment