Skip to content

Instantly share code, notes, and snippets.

@Somrlik
Created November 3, 2017 01:29
Show Gist options
  • Save Somrlik/8509b799db20a94c4e14ccfd35dce6ca to your computer and use it in GitHub Desktop.
Save Somrlik/8509b799db20a94c4e14ccfd35dce6ca to your computer and use it in GitHub Desktop.
A sql query that will create sql commands to convert all tables and columns from database to utf8mb4 so you can have emojis in text you sicko
SELECT CONCAT(
'ALTER TABLE ',TABLE_SCHEMA,'.',TABLE_NAME,
' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;'
)
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = 'databasename';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment