导入数据语句如下:
load data infile 'd:/userDesc.txt' into table test.user(uname,num,deptNum) terminated by ',' enclosed by '\'' lines terminated by '\r\n';
报错如下:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'termi
nated by ',' enclosed by '\'' lines terminated by '\r\n'' at line 1load data infile 'd:/userDesc.txt' into table test.user(uname,num,deptNum) terminated by ',' enclosed by '"' lines terminated by '\r\n';
报错同上,大虾赐教
load data infile 'd:/userDesc.txt' into table test.user(uname,num,deptNum) terminated by ',' enclosed by '\'' lines terminated by '\r\n';
报错如下:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'termi
nated by ',' enclosed by '\'' lines terminated by '\r\n'' at line 1load data infile 'd:/userDesc.txt' into table test.user(uname,num,deptNum) terminated by ',' enclosed by '"' lines terminated by '\r\n';
报错同上,大虾赐教
解决方案 »
- MYSQL存储过程字符集 一个非常纠结的问题
- 公司经常停电,数据库老是被挂,怎么办?
- 导入mysql数据在windows下正常,linux下中文乱码
- 在Linux下安装MySQL不成功,什么原因?
- 求助:PostgreSQL数据库的数据库大小限制问题
- 如何改变MYSQL的默认端品3306?
- 对MYSQL进行LOAD DATA INFILE '' INTO DATABASE能否在客户端程序中处理?
- mysql 联表查询的问题,请大家帮忙,谢谢
- mysql启动
- mysql数据写入硬盘延迟问题
- Python连接MySQL executeemany()问题。
- mysql api mysql_fetch_row 会因为系统压力而执行出错吗?
改回来了,谢谢大哥啊。
不过在执行的时候又报这种错误,挺奇怪的,能不能帮忙看看啊:
ERROR 1366 (HY000): Incorrect string value: '\xC9\xF2\xD7\xD4\xEF\xA3' for colum
n 'uname' at row 1mysql 字符编码是utf8,user表结构为:
+---------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| uname | varchar(255) | YES | | NULL | |
| num | varchar(64) | YES | | NULL | |
| deptNum | varchar(255) | YES | | NULL | |
+---------+--------------+------+-----+---------+----------------+
mysql字符集设置如下:
-> ;
+--------------------------+-------------------------------------------+
| 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 | D:\MySQL\MySQL Server 5.1\share\charsets\ |
+--------------------------+-------------------------------------------+
userDesc.txt字符编码通过ultraedit改为:utf-8
show create table显示表的字符编码为utf8
执行上面的导入语句后发现表中数据全是乱码,不知何故,网上说要改的地方都试过,没作用呢