To import and load data using the CSV storage engine for MySQL5.5
This article mainly explains "MySQL5.5 uses CSV storage engine to import and load data steps", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let the editor take you to learn the steps for MySQL5.5 to import and load data using the CSV storage engine.
-- View the contents of the csv text file
[root@localhost fire] # cat / tmp/dept.txt
10,ACCOUNTING,NEW YORK
20,RESEARCH,DALLAS
30,SALES,CHICAGO
40,OPERATIONS,BOSTON
-- create an CSV table based on the format of the text file
Mysql > CREATE TABLE `t_ dept` (
-> `deptno` int (11) NOT NULL DEFAULT'0'
-> `dname` varchar (15) NOT NULL
-> `loc` varchar (15) NOT NULL
->) ENGINE=CSV DEFAULT CHARSET=gbk
Query OK, 0 rows affected (0.06 sec)
-- Import the contents of the csv text file into the CSV file generated after the table is created
[root@localhost fire] # more / tmp/dept.txt > t_dept.CSV
[root@localhost fire] # cat t_dept.CSV
10,ACCOUNTING,NEW YORK
20,RESEARCH,DALLAS
30,SALES,CHICAGO
40,OPERATIONS,BOSTON
-- View the data imported into the table
Mysql > select * from t_dept
+-+
| | deptno | dname | loc | |
+-+
| | 10 | ACCOUNTING | NEW YORK |
| | 20 | RESEARCH | DALLAS |
| | 30 | SALES | CHICAGO |
| | 40 | OPERATIONS | BOSTON |
+-+
4 rows in set (0.07 sec)
At this point, I believe you have a deeper understanding of "MySQL5.5 uses the CSV storage engine to import and load data". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!