Share » Forums » Install & configuration » Database charset conversion...

Database charset conversion (downgrade sql to non utf-8)

Database charset conversion (downgrade sql to non utf-8)

Wednesday 24 January 2007 7:37:28 am - 5 replies

Modified on Tuesday 11 January 2011 12:53:11 am by Nicolas Pastorino

Author Message

Vicente Olivan

Wednesday 24 January 2007 9:57:31 am

Hi

I believe that is better crearte new database in mysql 4.0.x. with utf8 support

test this...

export old database:

mysqldump --opt database > backup.sql

create new database:

mysql -u root

CREATE DATABASE `database` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

quit

import old database:

mysql database < backup.sql

... you will not have to change all settings.

greetings

Kim Johansen

Thursday 25 January 2007 12:29:30 am

"DEFAULT CHARSET=" is not supported in mysql 4.0. You need to convert the database.

Dump the database and remember to use --skip-set-charset, or use the sed command after you have created the dump

mysqldump -u username -p --skip-set-charset database > dump.sql
sed -e 's/ DEFAULT CHARSET=UTF-8//' dump.sql > dump_fix.sql

Convert to ISO-8859-1

iconv --from-code=UTF-8 --to-code=ISO-8859-1 dump.sql > new_dump.sql

Dump database back to new server

mysql -u username -p database < new_dump.sql

This should be all.

Try out Free eZ Publish 4.0 Trial Hosting for 14 days:
http://webdealhosting.com/ez-publish-trial-hosting

High quality eZ Publish Hosting since 2001!

Kristof Coomans

Thursday 25 January 2007 12:53:08 am

Of course it depends on your needs, but I think that downgrading from utf8 to latin1 generally isn't a good idea. If it is possible then consider upgrading the mysql server.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Xavier Dutoit

Thursday 25 January 2007 5:38:35 am

Hi,

I have utf8 on mysql 4.0 servers. I know they are limitations/problems but it has been running smoothly on my sites so far.

Skip the iconv step and see how it works for you.

Another option (the one I used) was
1) create the tables (empty) on the 4.0 server
(kernel/sql/mysql/kernel_schema.sql )
2) dump only the datas from the 4.1 database

3) Import on the existing empty tables

Might make it easier...

Let us know.

X+

http://www.sydesy.com

zurgutt -

Wednesday 13 June 2007 1:11:00 am

Firstly: for the love of God (or whatever you love), keep everything everything in utf from the beginning. Saves so much headache.. i know..

For dump conversion see my solution on this thread: http://ez.no/community/forum/general/convert_from_iso_8859_1_encoding_to_utf_8/re_convert_from_iso_8859_1_encoding_to_utf_8__9

It has worked for me. But its crude, so heed the warnings. Might not work for you. But trying wont hurt.

Certified eZ developer looking for projects.
zurgutt at gg.ee

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu