How to change collation_database value in MySQL?

UPDATED: 04 September 2014
collation_database

A collation is a set of rules for comparing characters in a character set.
Read more about Character Sets and Collations in General.

How to check database collation character set in MySQL?
Execute following query to know the collation character set of current database.Currently its 'utf8_general_ci'.
SHOW VARIABLES LIKE '%collation_database%';
Variable_name value Value
collation_database utf8_general_ci


How to change database collation character set in MySQL?
We need to alter the database with new collation character set. We will change it to 'utf8_unicode_ci', change character set as per your requirement.
ALTER DATABASE inventory COLLATE utf8_unicode_ci;
Now lets check the collation character set again by executing same query.
SHOW VARIABLES LIKE '%collation_database%';
Variable_name value Value
collation_database utf8_unicode_ci


0 comments :