Sunday, October 05, 2008

mysql change database charset to unicode

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

No comments: