mysql 导入 sql 文件的问题( error 1146 42s02)
巴扎黑
巴扎黑 2017-04-17 13:15:24
0
1
662

我从某个数据库中导出了表结构和数据,放在 jd.sql 里面,如下图所示。

然后在 mysql 中用 source 命令导入数据,却发生了下图所示的错误,求解。

append:我要导入的sql文件在这里,有兴趣研究的可以下载一下。http://pan.baidu.com/s/1i3wCbm1

巴扎黑
巴扎黑

reply all(1)
阿神

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() FROM DUAL;

Select database:

use jd;


An important question, have you set it upcharacter_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)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!