Skip to content

Instantly share code, notes, and snippets.

@alkrauss48
Last active October 27, 2016 20:34
Show Gist options
  • Save alkrauss48/e34fb00632389a5f83af to your computer and use it in GitHub Desktop.
Save alkrauss48/e34fb00632389a5f83af to your computer and use it in GitHub Desktop.
MySQL CLI Commands for New DB & User
# Create the database
create database test_database;
# Create a user with a password
create user 'username'@localhost identified by 'password';
# Give the new user full privileges on the new database
grant all privileges on test_database.* to 'username'@localhost;
# Refresh everyone's privileges
flush privileges;
--
# Dump Database
mysqldump -uusername -p test_database > backup.sql
# Restore Database - be careful this command is 100% right
mysql -uusername -p test_database < backup.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment