Skip to content

Instantly share code, notes, and snippets.

@n1k0
Created November 8, 2009 09:07
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 n1k0/229187 to your computer and use it in GitHub Desktop.
Save n1k0/229187 to your computer and use it in GitHub Desktop.

How to export/import a mysql database with utf-8

Not easy, but doable:

  1. Exporting the database:

    $ mysqldump -uuser -p --opt --default-character-set=utf8 mabase > mabase.sql
  2. Charset conversion:

    $ iconv -f iso-8859-1 -t utf-8 mabase.sql > mabase_utf8.sql
  3. Reimport:

    $ mysql -uuser -p mabase < mabase_utf8.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment