Change mysql database character set to utf8

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__
# mysql -u root
mysql> ALTER DATABASE tips CHARACTER SET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec)
#mysql
0
Ivan Borshchov profile picture
Dec 28, 2016
by Ivan Borshchov
Did it help you?
Yes !
No

Best related