Skip to content

Instantly share code, notes, and snippets.

@ghostrocket
Created September 16, 2013 14:39
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 ghostrocket/6581566 to your computer and use it in GitHub Desktop.
Save ghostrocket/6581566 to your computer and use it in GitHub Desktop.
Fix Busted Characters after converting mysql db from latin1_swedish to utf8
mysql -uroot --password= --skip-column-names -e "select concat('update ', a.table_name, ' set ', a.column_name, ' = convert(cast(convert(', a.column_name, ' using latin1) as binary) using utf8);') from information_schema.columns a where a.table_schema = '$DB_SCHEMA';" > fixutf8.sql
mysql -uroot --password= $DB_SCHEMA < fixutf8.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment