我从某个数据库中导出了表结构和数据,放在 jd.sql 里面,如下图所示。然后在 mysql 中用 source 命令导入数据,却发生了下图所示的错误,求解。
append:我要导入的sql文件在这里,有兴趣研究的可以下载一下。http://pan.baidu.com/s/1i3wCbm1
Is jd your database name?
jd
When this happens, it is likely that when you source, the currently selected database is not jd
View current database:
SELECT DATABASE() FROM DUAL;
Select database:
use jd;
An important question, have you set it upcharacter_set_client?
character_set_client
set names 'gbk';
I tried it, everything defaulted, and the import was successful:
My local MySQL related encoding settings:
mysql> show variables like 'character%'; +--------------------------+---------------------------------------------------------+ | 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 | C:\Program Files\MySQL\MySQL Server 5.6\share\charsets\ | +--------------------------+---------------------------------------------------------+ 8 rows in set (0.00 sec)
Is
jd
your database name?When this happens, it is likely that when you source, the currently selected database is not
jd
View current database:
Select database:
An important question, have you set it up
character_set_client
?I tried it, everything defaulted, and the import was successful:
My local MySQL related encoding settings: