由于utf-8问题,Mysql恢复失败

时间:2013-04-01 06:29:58

标签: mysql mysqldump database-restore

这是我的猜测。恢复在UTF-8字符出现的行停止,这是一些非英语的特征。所以它搞砸了整个过程。

我想通过从另一个数据库转储的SQL文件来恢复数据库。另一个数据库正在使用所有utf-8。见第二部分。

任何人都可以告诉我转储命令和恢复命令将此问题考虑在内吗?

mysql> show variables like 'collation_%';
+----------------------+-----------------+
| Variable_name        | Value           |
+----------------------+-----------------+
| collation_connection | gbk_chinese_ci  |
| collation_database   | utf8_general_ci |
| collation_server     | gbk_chinese_ci  |
+----------------------+-----------------+
3 rows in set (0.02 sec)

mysql> show variables like 'character_set_%';
+--------------------------+----------------------------------------+
| Variable_name            | Value                                  |
+--------------------------+----------------------------------------+
| character_set_client     | gbk                                    |
| character_set_connection | gbk                                    |
| character_set_database   | utf8                                   |
| character_set_filesystem | binary                                 |
| character_set_results    | gbk                                    |
| character_set_server     | gbk                                    |
| character_set_system     | utf8                                   |
| character_sets_dir       | /usr/local/mysql/share/mysql/charsets/ |
+--------------------------+----------------------------------------+
8 rows in set (0.00 sec)

服务器SQL转储文件来自:

mysql> show variables like 'character_set_%';
+--------------------------+----------------------------------+
| Variable_name            | Value                            |
+--------------------------+----------------------------------+
| character_set_client     | utf8                             |
| character_set_connection | utf8                             |
| character_set_database   | utf8                             |
| character_set_filesystem | binary                           |
| character_set_results    | utf8                             |
| character_set_server     | utf8                             |
| character_set_system     | utf8                             |
| character_sets_dir       | /usr/local/mysql/share/charsets/ |
+--------------------------+----------------------------------+
8 rows in set (0.00 sec)

mysql> show variables like 'collation_%';
+----------------------+-----------------+
| Variable_name        | Value           |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database   | utf8_general_ci |
| collation_server     | utf8_general_ci |
+----------------------+-----------------+
3 rows in set (0.00 sec)

1 个答案:

答案 0 :(得分:0)

创建数据库时,使用phpmysql选择utf general,它应该完成这项工作,