Skip to content

Instantly share code, notes, and snippets.

@IAmJulianAcosta
Created October 24, 2015 17:31
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 IAmJulianAcosta/b4b6d89126e9a30e8172 to your computer and use it in GitHub Desktop.
Save IAmJulianAcosta/b4b6d89126e9a30e8172 to your computer and use it in GitHub Desktop.
Changing charset of all database tables
SELECT CONCAT( "ALTER TABLE `", TABLE_NAME, "` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" ) AS ExecuteTheString
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = "name_of_table"
AND TABLE_TYPE = "BASE TABLE"
LIMIT 0 , 30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment