Mysql Alter Collation In All Tables And Columns
This process can be easily done from PhpMyAdmin.
- In query below, change ‘database_name’ with your actual database name
- Run the query
- The queries you need to change the collation of all tables will be printed as a result. Copy the queries
- Run the queries
- Pet your cat (This step is optional)
SELECT CONCAT('ALTER TABLE `', t.`TABLE_SCHEMA`, '`.`', t.`TABLE_NAME`,
'` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;') as stmt
FROM `information_schema`.`TABLES` t
WHERE 1
AND t.`TABLE_SCHEMA` = 'database_name'
ORDER BY 1
Leave a comment