Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

To import and load data using the CSV storage engine for MySQL5.5

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report