• 1-888-289-2246
  • 24x7x365 Presence

How to check and change the collation and charset on a MySQL Database


There are times when a user needs a different collation and character set for the MySQL database instead of the default one and to do so as below is the way. First login onto the server and go to the MySQL prompt and submit:-

mysql -u root -p

use database_name

1) How to check the collation and charset on a database ?

SHOW VARIABLES LIKE ‘character_set_database’;
SHOW VARIABLES LIKE ‘collation_database’;

2) How to change the collation and charset on a database?

ALTER DATABASE database_name CHARACTER SET utf8 COLLATE utf8_general_ci;

flush privileges;

That’s it !! Again check the collation and character set of a database and it should be changed after this.

]]>


Leave a Reply

Your email address will not be published. Required fields are marked *