Skip to content

Instantly share code, notes, and snippets.

@teror4uks
Last active April 28, 2018 11:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teror4uks/824e813bd47a230ce4c6dfe5cb5708fb to your computer and use it in GitHub Desktop.
Save teror4uks/824e813bd47a230ce4c6dfe5cb5708fb to your computer and use it in GitHub Desktop.
Mysql reminder

Create db in utf-8 encoding

CREATE DATABASE <db_name> CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Recovery backup from archive

tar -xzOf <archive_name>.tar.gz | mysql -u root -p <db_name>

Dump and gzip

mysqldump -u root -ppasswod --all-databases | gzip > all.sql.gz

Restore from gz archive

gunzip < alldb.sql.gz | mysql -u [uname] -p[pass] [dbname]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment