MySQL导入之mysqlimport

1. mysqlimport参数

  mysqlimport客户端实际上就是“LOAD DATA”命令的一个包装实现,所以大部分参数选项与LOAD DATA相同。

  文件名与导入表相同,例如patient.txt, patient.text和 patient都将被导入到指定表patient中。

shell> mysqlimport [options] db_name textfile1 [textfile2 ...]

  mysqlimport的具体参数如下:

[root@chengyu ~]# mysqlimport --help
mysqlimport  Ver 8.0.20 for Linux on x86_64 (Source distribution)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Loads tables from text files in various formats.  The base name of the
text file must be the name of the table that should be used.
If one uses sockets to connect to the MySQL server, the server will open and
read the text file directly. In other cases the client will open the text
file. The SQL command 'LOAD DATA INFILE' is used to import the rows.

Usage: mysqlimport [OPTIONS] database textfile...
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql8/etc/my.cnf /usr/local/mysql8/my.cnf ~/.my.cnf 
The following groups are read: mysqlimport client
The following options may be given as the first argument:
--print-defaults         打印默认选项.
--no-defaults           除了登录文件,不读取其他选项文件中的任意默认参数.
--defaults-file=#       仅读取指定文件中的默认参数.
--defaults-extra-file=# global选项文件之后读取的指定选项文件.
--defaults-group-suffix=# Also read groups with concat(group, suffix)
--login-path=# 从.mylogin.cnf中读取登录路径选项.
  --bind-address= 在具有多个网络接口的计算机上,使用此选项选择用于连接到MySQL服务器的接口.
  --character-sets-dir=name 字符集的安装目录.
  --default-character-set=name 指定字符集.
  -c, --columns=name  指定列名,以逗号分隔.
  -C, --compress      Use compression in server/client protocol.
  -#, --debug[=#]      编写调试日志.
  --debug-check         程序退出时打印调试信息.
  --debug-info         程序退出时打印调试信息,内存和CPU统计信息.
  --default-auth=name Default authentication client-side plugin to use.
  -d, --delete        导入前清空表数据.
  --enable-cleartext-plugin 
                      Enable/disable the clear text authentication plugin.
  --fields-terminated-by=name 字段分隔符
  --fields-enclosed-by=name 字段包括符
  --fields-optionally-enclosed-by=name 列可选包括符
  --fields-escaped-by=name 列终止符
  -f, --force         忽略SQL error强制执行
  -?, --help          帮助信息展示
  -h, --host=name     将数据导入给定主机上的MySQL服务器,默认主机为localhost.
  -i, --ignore        数据重复导入时,保存旧的.
  --ignore-lines=#    忽略导入文件前n行.
  --lines-terminated-by=name 行终止符
  -L, --local         读取客户端本地数据文件.
  -l, --lock-tables   锁表以写入
  --low-priority      Use LOW_PRIORITY when updating the table.
  -p, --password[=name] 用户密码
  --plugin-dir=name   客户端plugins路径.
  -P, --port=#       连接端口.
  --protocol=name     protocol名(tcp, socket, pipe, memory).
  -r, --replace       数据重复时,替换旧的.
  -s, --silent        静默模式,仅在发生错误时才产生输出.
  -S, --socket=name   指定socket.
  --server-public-key-path=name 包含RSA公钥的文件的路径名.
  --ssl-mode=name     与服务器连接的所需SSL    
  --ssl-ca=name       包含受信任的SSL证书颁发机构列表的文件    
  --ssl-capath=name   包含受信任的SSL证书颁发机构证书文件的目录    
  --ssl-cert=name     包含X.509证书的文件    
  --ssl-cipher=name   连接加密的允许密码    
  --ssl-key=name      包含X.509密钥的文件    
  --ssl-crl=name      包含证书吊销列表的文件    
  --ssl-crlpath=name  包含证书吊销列表文件的目录    
  --tls-version=name  允许的TLS协议进行加密连接,允许的值有: TLSv1, TLSv1.1, TLSv1.2, TLSv1.3
  --ssl-fips-mode=name 是否在客户端启用FIPS模式,允许的值有: OFF, ON, STRICT
  --tls-ciphersuites=name 允许的TLSv1.3密码套件用于加密连接
  --use-threads=#     多线程执行.
  -u, --user=name     用户名.
  -v, --verbose       详细信息
  -V, --version       显示版本信息并退出  
  --compression-algorithms=name 用于服务器连接的允许压缩算法    
  --zstd-compression-level=# 与使用zstd压缩的服务器的连接的压缩级别,有效区间1-22,默认值3.

Variables (--variable-name=value)
and boolean options {
  FALSE|TRUE}  Value (after reading options)
--------------------------------- ----------------------------------------
bind-address                      (No default value)
character
  • 2
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值