Last active
October 27, 2016 20:34
-
-
Save alkrauss48/e34fb00632389a5f83af to your computer and use it in GitHub Desktop.
MySQL CLI Commands for New DB & User
This file contains 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
# 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