Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

How should I use the mysql and awk to change the charset for all the fields and tables for a specific database? I did not include username or password, so for sure it will not work.

Should I run it as it is and wait or does it need to be modified to work with authentication?

mysql --database=dbname -B -N -e "SHOW TABLES" \
| awk '{print "SET foreign_key_checks = 0; ALTER TABLE", $1, "CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; SET foreign_key_checks = 1; "}' \
| mysql --database=dbname &
share|improve this question

migrated from stackoverflow.com Apr 26 '13 at 7:47

This question came from our site for professional and enthusiast programmers.

add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.