mysql change collation to utf8

If your encoding is off and you didn’t get it right from the beginning changing it is not a difficult task to do – but doing it in production could be risky.

To check you database collation in MySQL you can use the following SQL statement:

SHOW TABLE STATUS;

This will show you a lot of useful info about your database including collation. If you want to check it for a specific table use the following SQL statement:

SHOW TABLE STATUS WHERE NAME = 'The Name of Your Table';

This will show you the same info as above but only for a specific table. And if you want to change you collation to utf8 use the following SQL statement:

ALTER TABLE The Name of Your Table CONVERT TO CHARACTER SET utf8;
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.