Skip to content

Instantly share code, notes, and snippets.

@jordelver
Last active December 20, 2015 19:48
Show Gist options
  • Save jordelver/6185467 to your computer and use it in GitHub Desktop.
Save jordelver/6185467 to your computer and use it in GitHub Desktop.
MySQL basics

MySQL basics

Dump the database

mysqldump -u root -p <database> > /path/to/file.sql

Restore the database

mysql -u root -p <database> < /path/to/file.sql

Create a new user

CREATE USER '<username>'@'localhost' IDENTIFIED BY '<password>';

Grant privileges to the user

GRANT ALL PRIVILEGES ON <database>.* TO '<user>'@'localhost';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment