Change Language Collation of all mySQL Database Tables

If the language collation of your production and staging site database server is different you can use the MySQL query below to create a new query which allows you to change the language collation of all database tables at once.

SELECT CONCAT("ALTER TABLE ", TABLE_SCHEMA, '.', TABLE_NAME," COLLATE latin1_general_ci;") AS ExecuteTheString
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA="DATABASE_NAME"
AND TABLE_TYPE="BASE TABLE";

Leave a Reply

Your email address will not be published. Required fields are marked *