snippetsqlMinor
How do I configure MySQL '5.1.49-1ubuntu8' to show multibyte characters?
Viewed 0 times
showmysqlmultibyte1ubuntu8howcharactersconfigure
Problem
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.
Even when I query a table using Workbench, I get 'NULL' in the name section which I want, should display multibyte characters.
Solution
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:
Give it a Try !!!
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 !!!
Code Snippets
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)Context
StackExchange Database Administrators Q#6194, answer score: 3
Revisions (0)
No revisions yet.