Created
May 6, 2017 06:18
-
-
Save motammem/b57a93ae986d469b8dbb6b9264130a60 to your computer and use it in GitHub Desktop.
Make all table and columns charset UTF-8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
############################################ | |
# Make all table and columns charset UTF-8 # | |
############################################ | |
# Replace parameters below before use | |
database=[database] | |
user=[user] | |
password=[password] | |
mysql.exe --database=${database} -u ${user} -p${password} -B -N -e "SHOW TABLES" \ | |
| awk.exe '{print "SET foreign_key_checks = 0; ALTER TABLE", $1, "CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; SET foreign_key_checks = 1; "}' \ | |
| mysql.exe -u ${user} -p${password} --database=${database} & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment