Skip to content

Instantly share code, notes, and snippets.

@zvermafia
Last active August 15, 2019 12:02
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 zvermafia/b30559956e25fdd471bbf4147b6dcc32 to your computer and use it in GitHub Desktop.
Save zvermafia/b30559956e25fdd471bbf4147b6dcc32 to your computer and use it in GitHub Desktop.
MySQL snippets
#################################################
# Create a database with charset utf8mb4 in MySQL
#################################################
# Syntax:
CREATE DATABASE <database_name> CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
# Example:
CREATE DATABASE mortal_kombat CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
###############################################################################
# Right way to get MySQL database dump (export) without loosing emojis (smiles)
###############################################################################
# Syntax:
mysqldump -u <username> -p --default-character-set=utf8mb4 <database_name> > <file_name>
# Example
mysqldump -u root -p --default-character-set=utf8mb4 mortal_kombat > mortal_kombat_2018_01_26.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment