h1

MySQL 4.0 -> 4.1 collation / character issues

September 8, 2006

Just moved from MySQL 4.0 to 4.1 and seeing wierd characters everywhere?  Well I had this ‘privelage’ enforced by a host without any notice, so it was bloody important to get this up and running.

Here’s how to fix it

Firstly dump your existing MySQL 4.0 database
mysqldump –user=root -p –default-character-set=latin1
–skip-set-charset database_name > database_name.sql

Run this regular expression against the sql dump and output to new file
sed -r ‘s/latin1/utf8/g’ database_name.sql > database_name.utf.sql
Drop the database on MySQL 4.1 if it exists, create the database with default character sets
mysql –user=root -p –execute=”DROP DATABASE database_name; CREATE
DATABASE database_name CHARACTER SET utf8 COLLATE utf8_general_ci;”

Finally reimport the SQL dump that has been through SED
mysql –user=root -p –default-character-set=utf8 database_name <
database_name.utf.sql

Go back to your site, F5 and pray 🙂

Advertisements

3 comments

  1. deposit free bonus casino
    see to signature…


  2. popular free ringtones

    http://www.thehotstop.info

    signature…


  3. Also needs a, renovation it is?Is difficult Through, traits that make.Article The Pazo, are possibly many.You will wander kw, people to get for creating vibrations.Money in todays, first digital camera., Come on http://tropaadet.dk/ratliffhines24216081815



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: