Change mysql schema and table collation


I was working performancing the Mysql DB and realized that some of my tables needed to be changed to UTF 8 from Latin. Here is the quick script to changing the Mysql schemas and Mysql table.

 ALTER DATABASE `Database_name` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci 
 ALTER TABLE `table_name` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci 

Just by changing the Schema does not changes all the tables in it. Individual tables need to be change. All the table, until explicitly told, will be made in the new collation / character set.

[category Mysql, DbAdmin]

Advertisements