Skip to content

Instantly share code, notes, and snippets.

@aamnah
Last active March 9, 2017 19:54
Show Gist options
  • Select an option

  • Save aamnah/3ac85de26de9a8b5bf68b8ecd08b42e1 to your computer and use it in GitHub Desktop.

Select an option

Save aamnah/3ac85de26de9a8b5bf68b8ecd08b42e1 to your computer and use it in GitHub Desktop.
MySQL: Create a database, user, and grant privileges
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