Skip to content

Instantly share code, notes, and snippets.

@rafaelrosafu
Created October 30, 2011 01:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafaelrosafu/1325356 to your computer and use it in GitHub Desktop.
Save rafaelrosafu/1325356 to your computer and use it in GitHub Desktop.
Migrating WP with latin symbols convertion
# Good reference
http://en.gentoo-wiki.com/wiki/Convert_latin1_to_UTF-8_in_MySQL
## On the original server on Dreamhost
# Backup the database, pay special attention to character set
mysqldump --user=grokpodcastcom -p --host=mysql.grokpodcast.com --default-character-set=latin1 -c --insert-ignore --skip-set-charset -r dump_grok.sql grokpodcast_com
# The sed replaces the WP instance prefix on the database and also it's name
sed -i 's/_5cweix_/_/' dump_grok.sql
sed -i 's/grokpodcast_com/bitnami_wordpress/' dump_grok.sql
# Put dump on S3 (easier than FTP)
s3cmd put --force dump_grok.sql s3://grokpodcast_backup
## On the ec2 instance
# Get dump from S3
s3cmd get s3://grokpodcast_backup .
# Erase the old database, create the new one with with UTF-8 charset and encoding
mysql --user=bitnami -p --execute="DROP DATABASE bitnami_wordpress; CREATE DATABASE bitnami_wordpress CHARACTER SET utf8 COLLATE utf8_general_ci;"
# Restore the database
mysql --user=bitnami -p --default-character-set=utf8 bitnami_wordpress < ./dump_grok.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment