Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I am using MySQL version 5.1.49 and I have now enabled UTF8 character encoding. The default character-set for MySQL is latin1. How can I change it show UTF8 characters?

Even when I query a table using Workbench, I get 'NULL' in the name section which I want, should display multibyte characters.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

You may want to consider setting the database's default character for new tables going forward using ALTER DATABASE. Here is an example using MySQL 5.5.12 for Windows:

mysql> show create database example;
+----------+--------------------------------------------------------------------+
| Database | Create Database                                                    |
+----------+--------------------------------------------------------------------+
| example  | CREATE DATABASE `example` /*!40100 DEFAULT CHARACTER SET latin1 */ |
+----------+--------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> alter database example default character set utf8;
Query OK, 1 row affected (0.01 sec)

mysql> show create database example;
+----------+------------------------------------------------------------------+
| Database | Create Database                                                  |
+----------+------------------------------------------------------------------+
| example  | CREATE DATABASE `example` /*!40100 DEFAULT CHARACTER SET utf8 */ |
+----------+------------------------------------------------------------------+
1 row in set (0.00 sec)

Give it a Try !!!

share|improve this answer
    
I have executed the command you suggested! But the problem is I already have data in the database Will these settings be applicable to that data too? –  vaibhav Sep 26 '11 at 21:26
    
Only data going forward. You may haver to reload. –  RolandoMySQLDBA Sep 26 '11 at 21:42

Don't forget to specify the characterset you're using client side too. From the mysql shell you would run

set names utf8;

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.