Login to Members Area

Choose the service you want to log in
24x7x365 Presence
Live Chat

Hosting Blog


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.

Sachin Thursday 20 June 2013 - 8:51 pm | | Default
Used tags: , ,

No comments

(optional field)
(optional field)

Comment moderation is enabled on this site. This means that your comment will not be visible until it has been approved by an editor.

Remember personal info?
Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.