How to change the default collation of a database?

Well, sometimes we didn’t pay attention at all to database collation. At some point, when the collation doesn’t support some character. The only option is to change the collation. Here is one of the tips on how to change the database collation:

change database collation:

ALTER DATABASE <database_name> CHARACTER SET utf8 COLLATE utf8_unicode_ci;
change table collation:

ALTER TABLE <table_name> CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
change column collation:

ALTER TABLE <table_name> MODIFY <column_name> VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Source: stackoverflow.com

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *