This article is about to explain how you can manage database collation and character set of your database. If you are working on website which covers only one language which is english then you may not worry about these stuff.
But If you are dealing with the multilinguag website which includes various languages (chinese, hindi, gujarati, etc.) then you MUST need to take care of this stuff.
To make your database able to handle these characters of different languages you need to set proper Database Collation and Character Set for the database.
Change MySQL Database Collation
Before set the proper Database Collation you may like to get the List of MySQL Database Collation. Execute below query to get the list of all available Database Collation.
[cc lang=”mysql”]
SHOW COLLATION;
[/cc]
You can select any Database Collation which arrived from above query.
Now to change the Database Collation you need to perform below query to change it.
[cc lang=”mysql”]
ALTER SCHEMA `schema_name` DEFAULT COLLATE collation_name_here ;
[/cc]
Note: To make your database able to handle these characters of different languages you need to set proper Database Collation and Character Set for the database.
Change MySQL Database Character Set
Same as Database Collation you can get the list of Character Set using below query.
[cc lang=”mysql”]
SHOW CHARACTER SET;
[/cc]
Now to change the Database Character Set you need to execure below query.
[cc lang=”mysql”]
ALTER SCHEMA `schema_name` DEFAULT CHARACTER SET character_set_name;
[/cc]
Conclusion
With this article you will come to know about how to set the Database Collation and Character Set in MySQL. This will be useful when you are facing a problem related to different language characters.
Next I will post the article about storing unicode characters in database. So subscribe to our feed with your email address.
[…] not sure about my ealier article then you would like to refer my earlier article which show ways to change the MySQL Database Collation. For now if you want to want to change the database collation then you need to execute below query […]
[…] This article is about to explain how you can manage database collation and character set of your database. Database Read the original post on DZone… […]