Skip to content

Instantly share code, notes, and snippets.

@samsargent samsargent/bash.sh
Created Mar 7, 2016

Embed
What would you like to do?
Bulk update to utf8/utf8_general_ci database + tables
DB="DBNAME"; ( echo 'ALTER DATABASE `'"$DB"'` CHARACTER SET utf8 COLLATE utf8_general_ci;'; mysql -u root "$DB" -e "SHOW TABLES" --batch --skip-column-names | xargs -I{} echo 'ALTER TABLE `'{}'` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;' ) | mysql -u root "$DB"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.