[英]First load of a txt file using the sql command line
I work locally with WAMPSERVER2.5我在本地使用 WAMPSERVER2.5
I built my dadabase on OpenOfficeCalc: db.txt我在 OpenOfficeCalc 上构建了我的数据库:db.txt
- Character set: Unicode (UTF-8)
- Field separator: ,
- Text separator: "
I want to import "db.txt" in a table named "db_pma" which is in the database named "hct" (in PhpMyAdmin)我想在名为“db_pma”的表中导入“db.txt”,该表位于名为“hct”的数据库中(在 PhpMyAdmin 中)
"db.txt" contains 2 fields: “db.txt”包含2个字段:
- string_field (character string, max:30)
- numeric_field (sample: 5862314523685.256325632)
Questions:问题:
1) Do I need to first create in PhpMyAdmin the structure of the table ("db_pma") which will contain the data? 1)我是否需要先在 PhpMyAdmin 中创建包含数据的表(“db_pma”)的结构?
2) I tried this code to import "db.txt" 2)我尝试使用此代码导入“db.txt”
mysql -h localhost -u root
LOAD DATA LOCAL INFILE 'db.txt'
INTO TABLE dp_pma
FIELDS TERMINATED BY ','
LINES TERMINATED BY 'AUTO';
It doesn't work.它不起作用。 Could you help me?你可以帮帮我吗?
请改用LINES TERMINATED BY '\\r\\n'
(对于 Windows)或LINES TERMINATED BY '\\n'
(对于 Linux)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.