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

How to quickly import mysql data

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Next, let's learn how to import mysql data quickly. I believe you will benefit a lot after reading it. The text is not much in essence. I hope this short article on how to import mysql data quickly is what you want.

Mysql data Import

Method 1: use mysqlimport

Mysqlimport is located in the mysql/bin directory and is a very effective tool for mysql to load (or import) data.

For example (to log in to the host where the database resides):

Mysqlimport-- fields-terminated-by=,-- fields-enclosed-by=\ "Database name / file absolute path / text.txt-- local

The full format is as follows:

Mysqlimport-h IP address-u user-p password database name-- fields-terminated-by=' |'/ absolute path / text.txt'-- columns='user_id,user_name,user_age,user_addr'-- local

Note:

1. There can be no spaces between Mutual and password.

two。 The database table name imported here should be the same as the file name, that is, text

3. Other instructions

-- fields-enclosed- by= char

Specifies what is enclosed when recording data in a text file, and in many cases the data is enclosed in double quotes. By default, the data is not enclosed in characters.

-- fields-terminated- by=char

Specifies the delimiter between the values of each data. In a period-delimited file, the delimiter is a period. You can use this option to specify a separator between data. The default delimiter is the jumper (Tab)

-- local reads input files from the local client

-- the field name of the columns to load the file into the table

Method 2

Mysql-u user name-p database name-e "load data LOCAL infile'/ file absolute path / text.txt' into table table name fields terminated by\",\ "enclosed by\"\ "

Enter the password when prompted for the password

Other options are explained as method 1.

Method 3 (another way of method 2)

Mysql-u user name-p database name

Enter the password when prompted to enter the password, and enter the mysql > interactive interface. You do not need to enter the password when entering the library, and you can perform the storage operation many times.

Load data LOCAL infile "/ file absolute path / text.txt" into table table name fields terminated by "," enclosed by ""

After reading this article on how to import mysql data quickly, many readers will want to know more about it. If you need more industry information, you can follow our industry information section.

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