PHP and MySQL is a popular pair for web development, but sometimes we need to change the default collation to display the right language and faster for MySQL, in this case, let’s check some of simple tips to do that.

Change database collation:

Change table collation:

Change column collation:

Heres how to change all databases/tables/columns. Run these queries and they will output all of the subsequent queries necessary to convert your entire schema to utf8. Hope this helps!

Change DATABASE Default Collation

Change TABLE Collation / Char Set

Change COLUMN Collation / Char Set

Reference:

https://stackoverflow.com/questions/5906585/how-to-change-the-default-collation-of-a-database

https://stackoverflow.com/questions/1036454/what-are-the-diffrences-between-utf8-general-ci-and-utf8-unicode-ci

One thought on “Change the default collation of MySQL database

Comments are closed.