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

Steps for mysqlimport to import a database

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly explains the "steps to import mysqlimport into the database", the content of the explanation is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn the steps of "mysqlimport into the database"!

Mysqlimport

The mysqlimport directive can be used to import data from a text file into a database. When importing a text file, you must make sure that there is a table in the database and that its name is the same as the name of the text file.

The scope of application of this command: RedHat, RHEL, Ubuntu, CentOS, Fedora.

1. Grammar

Mysqlimport [options] dbname textfile1...

2. List of option parameters

Option

Description

-? |-- help

Display help information

-- bind-address=ip

Bind ip

-- character-sets-dir

Default character set directory

-I |-- ignore

Same as replace option

-c |-- columns

Set the list of fields

-C |-- compress

Use compressed statements between the server and the client

-D |-- delete

Delete database tables before importing data

-f |-- force

Enforcement

-ignore-lines

Ignore the first n lines

-L |-- local

Read content from the client host

-l |-- local-tables

Lock the table before performing a write operation

-P |-- port

Designated port

-- protocol

Specified protocol

-r |-- replace

If there are the same lines, so long to overwrite

-v |-- verbose

Show detailed procedures

-V |-- version

Display version information

-u |-- users

Designated user

-p |-- password

Specify password

3. Examples

Import database files

[root@localhost ~] # cat wj.txt / / View text content

1 zhangsan

2 lisi

3 wangwu

4 zhangliu

[root@localhost ~] # mysqlimport-v-u root-p test wj.txt / / Import text into the database. The premise is that there must be a table with the same name as the text file.

Enter password:

Connecting to localhost

Selecting database test

Loading data from SERVER file: wj.txt into wj

Test.wj: Records: 4 Deleted: 0 Skipped: 0 Warnings: 0

Disconnecting from localhost

[root@localhost ~] # mysql-u root-p-e 'select * from wj' test / / View the contents of table wj in the database

Enter password:

+-+ +

| | id | name |

+-+ +

| | 1 | zhangsan |

| | 2 | lisi |

| | 3 | wangwu |

| | 4 | zhangliu |

+-+ +

Thank you for your reading, the above is the content of "mysqlimport import database steps", after the study of this article, I believe you have a deeper understanding of the steps of mysqlimport import database, the specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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

Servers

Wechat

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

12
Report