我运行了以下bash脚本,用于从非unicode到utf-8的转换
#!/bin/bash -e
DB_HOST="localhost"
DB_USER="username"
DB_PASSWORD="paassword"
DB_NAME="dbname"
mysqldump -h "$DB_HOST" -u "$DB_USER" - p"$DB_PASSWORD" --opt --quote-names -- skip-set-charset --default-character-set=latin1 "$DB_NAME" > /tmp/temp.sql;
mysql -h "$DB_HOST" -u "$DB_USER" - p"$DB_PASSWORD" --default-character- set=utf8 "$DB_NAME" < /tmp/temp.sql;
这就成功了。我用庄严的文字打开数据库,法语字符被正确地呈现出来。
有关此的详细信息,请访问https://codex.wordpress.org/Converting_Database_Character_Sets