Le Tue, 23 Dec 2008 15:33:34 +0000, KLEIN Stéphane a écrit : > Le Tue, 23 Dec 2008 14:42:40 +0000, KLEIN Stéphane a écrit : > >> Hi, >> >> This my script to convert latin1 database to utf8 : >> >> $ mysqldump --user=root --password=password --host=mybox mydatabase -- >> default-character-set=latin1 > mydatabase.latin1.sql$ mysqldump -- >> user=root --password=password --host=mybox mydatabase >> --default-character- set=latin1 > mydatabase.latin1.sql $ sed -e >> 's/latin1/utf8/g' mydatabase.latin1.sql > mydatabase.utf8.sql $ iconv >> -f latin1 -t utf8 mydatabase.utf8.sql > mydatabase.utf8.sql $ echo "SET >> NAMES utf8;" > tmp.sql >> $ cat mydatabase.utf8.sql >> tmp.sql >> $ mv tmp.sql mydatabase.utf8.sql >> >> I've one question : >> >> * if my database have some blob field with binary data (like image...), >> iconv convert also this data then this data will be corrupted ? > > I've the answer ! > > My previous script corrupt binary data. > > To fix this issue I need to dump data with --hex-dump option : > > $ mysqldump --hex-dump --user=root --password=password --host=mybox > mydatabase --default-character-set=latin1 > mydatabase.latin1.sql$ > mysqldump --user=root --password=password --host=mybox mydatabase
Sorry, it's --hex-blob not --hex-dump $ mysqldump --hex-blob --user=root --password=password --host=mybox mydatabase --default-character-set=latin1 > mydatabase.latin1.sql Regards, Stephane -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=arch...@jab.org