Database Research & Development

  • Home
  • NoSQL
    • NoSQL
    • Cassandra
  • Databases
    • Database Theory
    • Database Designing
    • SQL Server Coding Standards
    • SQL Server
    • PostgreSQL
    • MySQL
    • Greenplum
    • Linux
  • Interviews
    • SQL Server Interviews
    • MySQL Interviews
    • SQL Puzzles
  • DBA Scripts
    • SQL Server DBA Scripts
    • PostgreSQL DBA Scripts
    • MySQL DBA Scripts
    • Greenplum DBA Scripts
  • Home
  • Blog Archives !
  • (: Laugh@dbrnd :)
  • Contact Me !
sqlserverinterviews
Home 2015 October MySQL: How to change default Character set to UTF-8

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

This article is half-done without your Comment! *** Please share your thoughts via Comment ***

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

Sometimes, it requires changing 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 a standard configuration, and you do not need to change anything, but if your application requires storing data using a different character set, you have to change this default configuration.

Here, I am showing how 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.

1
2
SHOW VARIABLES LIKE 'chara%';
SHOW VARIABLES LIKE 'collation%';

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

1
2
3
4
5
6
7
8
9
10
[client]
default-character-set=utf8
 
[mysql]
default-character-set=utf8
 
[mysqld]
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8

Specify Character Settings per Database:

1
2
3
CREATE DATABASE MyDatabase
DEFAULT CHARACTER SET utf8
DEFAULT COLLATE utf8_general_ci;

Oct 30, 2015Anvesh Patel
Database Theory: What is Character Set and CollationMySQL: Error Code-1175 You are using safe update mode
Comments: 4
  1. Mary
    November 15, 2015 at 10:36 pm

    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!

  2. Prince
    December 31, 2015 at 8:42 am

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

  3. Deny
    January 16, 2016 at 7:39 am

    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.

  4. antoni
    January 20, 2016 at 5:54 pm

    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!

Anvesh Patel
Anvesh Patel

Database Engineer

October 30, 2015 MySQLAnvesh Patel, character set, collation, database, database research and development, dbrnd, MySQL, MySQL Command, MySQL Database Administrator, MySQL Database Designing, MySQL Database Programming, MySQL Error, MySQL Performance Tunning, MySQL Query, MySQL Tips and Tricks, utf-8
About Me!

I'm Anvesh Patel, a Database Engineer certified by Oracle and IBM. I'm working as a Database Architect, Database Optimizer, Database Administrator, Database Developer. Providing the best articles and solutions for different problems in the best manner through my blogs is my passion. I have more than six years of experience with various RDBMS products like MSSQL Server, PostgreSQL, MySQL, Greenplum and currently learning and doing research on BIGData and NoSQL technology. -- Hyderabad, India.

About DBRND !

dbrnd

This is a personal blog (www.dbrnd.com).

Any views or opinions represented in this blog are personal and belong solely to the blog owner and do not represent those of people, institutions or organizations that the owner may or may not be associated with in professional or personal capacity, unless explicitly stated.

Feel free to challenge me, disagree with me, or tell me I’m completely nuts in the comments section of each blog entry, but I reserve the right to delete any comment for any reason whatsoever (abusive, profane, rude, or anonymous comments) - so keep it polite.

The content of this website is protected by copyright. No portion of this website may be copied or replicated in any form without the written consent of the website owner.

Recent Comments !
  • Anvesh Patel { Sure will do... } – May 27, 12:43 PM
  • Anvesh Patel { Great... } – May 27, 12:41 PM
  • Anvesh Patel { Great... } – May 27, 12:39 PM
  • Anvesh Patel { Great... } – May 27, 12:36 PM
  • Anvesh Patel { Great... } – May 27, 12:28 PM
  • Anvesh Patel { Great... } – May 27, 12:27 PM
  • Anvesh Patel { Great... } – May 27, 12:16 PM
  • Older »
Follow Me !
  • facebook
  • linkedin
  • twitter
  • youtube
  • google
  • flickr
© 2015 – 2019 All rights reserved. Database Research & Development (dbrnd.com)
Posting....