Bug #22109 Slave breaks charset in replicating 'LOAD DATA' statement
Submitted: 8 Sep 2006 8:54 Modified: 23 Oct 2006 11:39
Reporter: Hu Hailin Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Replication Severity:S2 (Serious)
Version:5.0.24a OS:Linux (CentOS release 4.2 (Final))
Assigned to: CPU Architecture:Any
Tags: charset, LOAD DATA, replication

[8 Sep 2006 8:54] Hu Hailin
Description:
When master server did a LOAD DATA job including some charset setting, the slave failed to replicate the job with proper charset. So the data on slave would be messed up.

How to repeat:
All operations below are on the master server:

1. INITIALIZE
CREATE DATABASE `ja` CHARACTER SET ujis;
CREATE TABLE `ja`.`ujis` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(255) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB;

2. JOB (ujis.sql)
USE ja;
TRUNCATE TABLE ujis;
LOAD DATA LOCAL INFILE 'ujis.csv' INTO TABLE ujis
  FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY ''
  LINES TERMINATED BY '\r\n'
  ( name );

3. DATA (ujis.csv)
---quote--
あいうえお
かきくけこ
さしすせそ
たちつてと
なにぬねの
---quote--
line feed is CR+LF, charset is EUC-JP

4. EXECUTE
/usr/local/mysql-master/bin/mysql --local-infile -S /tmp/mysql-master.sock -u root < ujis.sql

5. RESULT
The data on the master server is right as usual. But the data on the slave server is messed up, just like the character_set_database system variable is still latin1.
[8 Sep 2006 11:55] Valeriy Kravchuk
Thank you for a problem report. Please, send my.cnf from your master and slave, for completeness.
[11 Sep 2006 0:28] Hu Hailin
my.cnf of master and slave

Attachment: my.cnf.tar.gz (application/x-gzip, text), 2.34 KiB.

[11 Sep 2006 10:31] Hu Hailin
my.cnf uploaded.
I'm sorry to miss the note that I should add comment to update the bug status.
[23 Oct 2006 11:39] Valeriy Kravchuk
Duplicate of bug #15126, almost surely.