Q: MySQL 4 utf8 charset support.
A: For MySQL 4.1 or later, if you want UTF-8 support, you must create the bugzero database use
the utf8 charset or must alter the database before any bugzero tables were created there.
Below is the command:
mysql> CREATE DATABASE bugzero_db CHARACTER SET utf8;
or, if you create the database without the character set, you can alter it bt
mysql> ALTER DATABASE bugzero_db CHARACTER SET utf8;
After alter your database charset, you will need remove all the tables and re-create them
(or do alter table table_name character set utf8).
Of course, if you are aready using utf8 as the default charset for the mysql server, then
you do not need do anything to the bugzero_db database. Also note that, this is only for
MySQL 4.1 or later.
Data Migration issues:
If you are migrating from Mysql 4 to later versions using mysqldump, the table charset may
not match to the database charset. Use
mysql> SHOW CREATE TABLE `project`;
to find out the charset for the tables. If they are different from the database charset, you
may have a problem:
1. Query results become case-sensitive.
2. Problem in saving unicode characters, errors like
java.sql.SQLException: General error message from server:
"Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='"
To fix the problem, you can do
mysql> ALTER TABLE table_name CHARACTER SET utf8;
for all the tables. That might just solve the problem.
Otherwise, you can also re-import the database, using the right mysqldump option:
--default-character-set=utf8
* Reference brought to you by
Bugzero, it's more than just bug tracking software!
|
Home -
FAQs
|
|