Skip to content

Instantly share code, notes, and snippets.

@filipemansano
Created July 20, 2020 22:13
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 filipemansano/b0e646ba23222bd8591073c507675261 to your computer and use it in GitHub Desktop.
Save filipemansano/b0e646ba23222bd8591073c507675261 to your computer and use it in GitHub Desktop.
generate script to convert all tables to the same collation
SELECT CONCAT("ALTER TABLE `", TABLE_SCHEMA, '`.`', TABLE_NAME,"` COLLATE utf8mb4_0900_ai_ci;") AS ExecuteTheString
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA="[DATABASENAME]"
AND TABLE_TYPE="BASE TABLE";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment