Skip to content

Instantly share code, notes, and snippets.

@Walkeryr
Last active December 31, 2015 05:29
Show Gist options
  • Save Walkeryr/7941061 to your computer and use it in GitHub Desktop.
Save Walkeryr/7941061 to your computer and use it in GitHub Desktop.
MySQL main administration commands
-- Change password for user to specific database
-- Create database
create database mydb;
-- Select database
use mydb;
-- Create user
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypassword';
-- Grant privileges to database
GRANT ALL PRIVILEGES ON mydb.* TO 'myuser'@'localhost';
-- Change password
SET PASSWORD FOR 'tom'@'localhost' = PASSWORD('foobar');
-- Update privileges
FLUSH PRIVILEGES;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment