[rt-users] Mysql upgrading to RT3.8 gives you garbled UTF8 text

Mathieu Longtin mlongtin at dbsoft.ca
Mon Jul 28 12:14:57 EDT 2008


First, thanks for the 3.8 upgrade. Much appreciated.

I already had accents in my tickets, and running schema.mysql-4.0-4.1.pl
would garble them. This is using mysql 5.0.51a on Redhat.

I discovered that if I skip the VARBINARY part of the upgrade, the data
is fine. So instead of

	ALTER TABLE Tickets MODIFY Subject VARBINARY(10) NULL DEFAULT
NULL;
	ALTER TABLE Tickets MODIFY Subject VARCHAR(10) CHARACTER SET
utf8 NULL DEFAULT NULL;

Just do:

	ALTER TABLE Tickets MODIFY Subject VARCHAR(10) CHARACTER SET
utf8 NULL DEFAULT NULL;

So, if your data is garbled post upgrade, restore your backup (you had a
backup, right?), and follow these instructions to run
schema.mysql-4.0-4.1.pl.

You can easily get those UTF8 modify commands like this:
 
	perl schema.mysql-4.0-4.1.pl rt rt_user rt_pass | grep
MODIFY.*utf8


Of course, you still need to fix the NOT NULL DEFAULT NULL issue. So,
the full command:

	perl schema.mysql-4.0-4.1.pl rt rt_user rt_pass | \
	grep MODIFY.*utf8 | \
	perl -pe 's/NOT NULL DEFAULT NULL/NOT NULL/' | \
	mysql -urt_user -prt_pass rt

Then, run schema.mysql-4.0-4.1.pl normally, the columns that were fixed
already won't be refixed by the upgrade script again.

	perl schema.mysql-4.0-4.1.pl rt rt_user rt_pass | \
	perl -pe 's/NOT NULL DEFAULT NULL/NOT NULL/' | \
	mysql -urt_user -prt_pass rt


-Mathieu



More information about the rt-users mailing list