Skip to content

Instantly share code, notes, and snippets.

@matusmarcin
Last active October 31, 2018 22:47
Show Gist options
  • Save matusmarcin/85d941af804cd0ec5a15 to your computer and use it in GitHub Desktop.
Save matusmarcin/85d941af804cd0ec5a15 to your computer and use it in GitHub Desktop.
All MySQL CLI stuff I ever needed
CREATE DATABASE `db`;
CREATE USER 'matus'@'localhost' IDENTIFIED BY 'pwd';
GRANT ALL ON db.* TO 'matus'@'localhost';

MySQL CLI for a specific DB:

$ mysql -u matus -pppassword -D db

Dump a DB:

$ mysqldump db -u matus -ppassword > dump.sql

Import dump into a specific DB:

$ mysql -u matus -pppassword -D db < dump.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment