Skip to content

Instantly share code, notes, and snippets.

@cboulanger
Created November 27, 2015 13:39
Show Gist options
  • Save cboulanger/c8c119f5235116d3373a to your computer and use it in GitHub Desktop.
Save cboulanger/c8c119f5235116d3373a to your computer and use it in GitHub Desktop.
DB="dbname"; ( echo 'ALTER DATABASE `'"$DB"'` CHARACTER SET utf8 COLLATE utf8_general_ci;'; mysql "$DB" -e "SHOW TABLES" --batch --skip-column-names | xargs -I{} echo 'ALTER TABLE `'{}'` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;' ) | mysql "$DB"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment