MySQL: How to change default Character set to UTF-8

In the previous post, I have discussed and provided small note on Database Character Set and Collation.
In this post, I show you that how you can configure or change default Character Set in MySQL.

Sometimes it is required to change the default character set of MySQL Server or MySQL Database.
A Character set “latin1” and Collation “latin1_swedish_ci” are the default of MySQL Server.
This is standard configuration and you do not need to change anything but if your application requires to store data using a different character set, you have to change this default configuration.

Here, I am showing to change your default character set and collation to UTF-8.

MySQL Server provides, different three ways to configure character set and collation.

  • Configure Character set and Collation at Database Level.
  • Configure Character set and Collation at Server Startup.
  • Configure Character set and Collation during MySQL Server Installation and Configuration.

First, check your default Character Set and Collation of MySQL Server.

If you want to change default to UTF-8, you want to add the following to my.cnf (MySQL Configuration File).

Specify Character Settings per Database:

Anvesh Patel

Leave a Reply

4 Comments on "MySQL: How to change default Character set to UTF-8"

Notify of
avatar
Sort by:   newest | oldest | most voted
Mary
Guest

When someone writes an paragraph he/she maintains the image of
a user in his/her brain that how a user can know it.

So that’s why this piece of writing is great. Thanks!

Prince
Guest

I was examining some of your blog posts on this site and I think this internet site is rattling instructive! Continue posting.

Deny
Guest

I do agree with all of the ideas you have presented in your post. They’re very convincing and will definitely work. Still, the posts are very short for newbies. Could you please extend them a little from next time? Thanks for the post.

antoni
Guest

Wow, incredible blog layout! How long have you been blogging for?
you make blogging look easy. The overall look of your web site is
excellent, let alone the content!

wpDiscuz