Advertisement

08.04.2007 at 02:47PM PDT, ID: 22742218
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.4

MySql DB Conversion to UTF8

Asked by johnike in MySQL Server, Databases Miscellaneous, SQL Query Syntax

Tags: ,

I am an experienced Java / database developer, but I have never gone through a conversion of a database from latin1 to UTF8.   I am using MySQL 5.0.27.  I am especially concerned because I am working with a live US site that I need to convert to be able to handle also Chinese and other languages.   The US site can't break.

The main piece for this question is how do I feel comfortable about the database changes?

So far what I have done so far is changed my my.cnf file to have the following information only:
[client]
default-character-set=utf8

[mysqld]
default-character-set=utf8
character_set_server=utf8
collation_server=utf8_general_ci
init_connect='SET collation_connection = utf8_general_ci'
init_connect='SET CHARACTER_SET utf8'
init_connect='SET NAMES utf8'

[mysql]
default-character-set=utf8

Now when I do:  show variables like "%character%";show variables like "%collation%";

I am getting the results of:

+--------------------------+--------------------------+
| Variable_name            | Value                    |
+--------------------------+--------------------------+
| character_set_client     | utf8                     |
| character_set_connection | utf8                     |
| character_set_database   | latin1                   |
| character_set_filesystem | binary                   |
| character_set_results    | utf8                     |
| character_set_server     | utf8                     |
| character_set_system     | utf8                     |
| character_sets_dir       | C:\mysql\share\charsets\ |
+--------------------------+--------------------------+
8 rows in set (0.06 sec)

+----------------------+-------------------+
| Variable_name        | Value             |
+----------------------+-------------------+
| collation_connection | utf8_general_ci   |
| collation_database   | latin1_swedish_ci |
| collation_server     | utf8_general_ci   |
+----------------------+-------------------+
3 rows in set (0.00 sec)

Note that I am still seeing the two configuration items still being latin1 oriented.   Do I need to dump the database and recreated it?  Do I need to do a data conversion first?   If so what might that be?   Would ALTER database be enough?   Do I need to put UTF8 on all table creations in the future and database creations in the future?  Do I need to do something to make sure dumps work correctly in UTF8?

I realize from my Java Object Relational Bridge connection I need to also set the CONNECT=UTF8 or some such.   But is that all?

I am also using Lucene for search engine capabilities.  I assume Chinese with multi-byte might not work the same, but don't understand the full scope of that.  I think I might need to pull in a multi-byte parser.

If only one thing, I want to make sure I am using the database part right here.

I realize this is a difficult question, but thank you very much in advance for any help.  Until I feel comfortable, I don't make much useful progress and I don't want to destroy our production environment.

John
Start Free Trial
[+][-]08.06.2007 at 01:29PM PDT, ID: 19641350

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: MySQL Server, Databases Miscellaneous, SQL Query Syntax
Tags: mysql, utf8
Sign Up Now!
Solution Provided By: Rurne
Participating Experts: 2
Solution Grade: B
 
 
[+][-]08.06.2007 at 03:30PM PDT, ID: 19642153

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.08.2007 at 02:35AM PDT, ID: 19652597

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628