Skip to content

Instantly share code, notes, and snippets.

@ramezanpour
Last active February 12, 2018 13:02
Show Gist options
  • Save ramezanpour/78feca40cc083f818c636310fb0ce8f9 to your computer and use it in GitHub Desktop.
Save ramezanpour/78feca40cc083f818c636310fb0ce8f9 to your computer and use it in GitHub Desktop.
Create a database and user in my sql and grant access to it
CREATE DATABASE mydatabase CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON [database] . * TO 'newuser'@'localhost';
GRANT ALL PRIVILEGES ON [database].* TO 'newuser'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment