mysqlimport 資料匯入程式
mysqlimport 資料匯入程式
mysqlimport客戶端提供了一個命令列介面來執行load data infile SQL語句。大多數的mysqlimport直接與load data infile語法的子句相關。
其使用語法為:
shell>mysqlimport [options] db_name textfile1 [textfile2 ...] mysql -e 'create table imptest(id int,n varchar(30))' mysql [mysql@localhost ~]$ mysql -uroot -pxxzx7817600 -e 'create table imptest(id int,n varchar(30))' mysql mysql: [Warning] Using a password on the command line interface can be insecure. [mysql@localhost ~]$ vi imptest.txt 100 Max Sydow 101 Count Dracula [mysql@localhost ~]$ od -c imptest.txt 0000000 1 0 0 M a x S y d o w \n 1 0 0000020 1 C o u n t D r a c u l a \n 0000040 [mysql@localhost ~]$ mysqlimport --local mysql imptest.txt -uroot -pxxzx7817600 --fields-terminated-by="|" mysqlimport: [Warning] Using a password on the command line interface can be insecure. mysql.imptest: Records: 2 Deleted: 0 Skipped: 0 Warnings: 0 [mysql@localhost ~]$ mysql -uroot -pxxzx7817600 -e 'SELECT * FROM imptest' mysql mysql: [Warning] Using a password on the command line interface can be insecure. +------+---------------+ | id | n | +------+---------------+ | 100 | Max Sydow | | 101 | Count Dracula | +------+---------------+ [mysql@localhost ~]$ mysqlimport --help mysqlimport Ver 3.7 Distrib 5.7.26, for Linux (x86_64) Copyright (c) 2000, 2019, 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 /mysqlsoft/mysql/etc/my.cnf /mysqlsoft/mysql/my.cnf ~/.my.cnf The following groups are read: mysqlimport client The following options may be given as the first argument: --print-defaults Print the program argument list and exit. --no-defaults Don't read default options from any option file, except for login file. --defaults-file=# Only read default options from the given file #. --defaults-extra-file=# Read this file after the global files are read. --defaults-group-suffix=# Also read groups with concat(group, suffix) --login-path=# Read this path from the login file. --bind-address=name IP address to bind to. --character-sets-dir=name Directory for character set files. --default-character-set=name Set the default character set. -c, --columns=name Use only these columns to import the data to. Give the column names in a comma separated list. This is same as giving columns to LOAD DATA INFILE. -C, --compress Use compression in server/client protocol. -#, --debug[=#] This is a non-debug version. Catch this and exit. --debug-check This is a non-debug version. Catch this and exit. --debug-info This is a non-debug version. Catch this and exit. --default-auth=name Default authentication client-side plugin to use. -d, --delete First delete all rows from table. --enable-cleartext-plugin Enable/disable the clear text authentication plugin. --fields-terminated-by=name Fields in the input file are terminated by the given string. --fields-enclosed-by=name Fields in the import file are enclosed by the given character. --fields-optionally-enclosed-by=name Fields in the input file are optionally enclosed by the given character. --fields-escaped-by=name Fields in the input file are escaped by the given character. -f, --force Continue even if we get an SQL error. -?, --help Displays this help and exits. -h, --host=name Connect to host. -i, --ignore If duplicate unique key was found, keep old row. --ignore-lines=# Ignore first n lines of data infile. --lines-terminated-by=name Lines in the input file are terminated by the given string. -L, --local Read all files through the client. -l, --lock-tables Lock all tables for write (this disables threads). --low-priority Use LOW_PRIORITY when updating the table. -p, --password[=name] Password to use when connecting to server. If password is not given it's asked from the tty. --plugin-dir=name Directory for client-side plugins. -P, --port=# Port number to use for connection or 0 for default to, in order of preference, my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306). --protocol=name The protocol to use for connection (tcp, socket, pipe, memory). -r, --replace If duplicate unique key was found, replace old row. --secure-auth Refuse client connecting to server if it uses old (pre-4.1.1) protocol. Deprecated. Always TRUE -s, --silent Be more silent. -S, --socket=name The socket file to use for connection. --ssl-mode=name SSL connection mode. --ssl Deprecated. Use --ssl-mode instead. (Defaults to on; use --skip-ssl to disable.) --ssl-verify-server-cert Deprecated. Use --ssl-mode=VERIFY_IDENTITY instead. --ssl-ca=name CA file in PEM format. --ssl-capath=name CA directory. --ssl-cert=name X509 cert in PEM format. --ssl-cipher=name SSL cipher to use. --ssl-key=name X509 key in PEM format. --ssl-crl=name Certificate revocation list. --ssl-crlpath=name Certificate revocation list path. --tls-version=name TLS version to use, permitted values are: TLSv1, TLSv1.1 --use-threads=# Load files in parallel. The argument is the number of threads to use for loading data. -u, --user=name User for login if not current user. -v, --verbose Print info about the various stages. -V, --version Output version information and exit. Variables (--variable-name=value) and boolean options {FALSE|TRUE} Value (after reading options) --------------------------------- ---------------------------------------- bind-address (No default value) character-sets-dir (No default value) default-character-set auto columns (No default value) compress FALSE default-auth (No default value) delete FALSE enable-cleartext-plugin FALSE fields-terminated-by (No default value) fields-enclosed-by (No default value) fields-optionally-enclosed-by (No default value) fields-escaped-by (No default value) force FALSE host (No default value) ignore FALSE ignore-lines 0 lines-terminated-by (No default value) local FALSE lock-tables FALSE low-priority FALSE plugin-dir (No default value) port 0 replace FALSE secure-auth TRUE silent FALSE socket (No default value) ssl TRUE ssl-verify-server-cert FALSE ssl-ca (No default value) ssl-capath (No default value) ssl-cert (No default value) ssl-cipher (No default value) ssl-key (No default value) ssl-crl (No default value) ssl-crlpath (No default value) tls-version (No default value) use-threads 0 user (No default value) verbose FALSE
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26015009/viewspace-2871755/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Linux基礎命令---mysqlimport匯入資料庫LinuxMySqlImport資料庫
- 資料庫 MySQL 資料匯入匯出資料庫MySql
- TP5.1excel匯入資料庫的程式碼?php excel如何匯入資料庫?Excel資料庫PHP
- sqoop資料匯入匯出OOP
- Oracle 資料匯入匯出Oracle
- 資料泵匯出匯入
- Oracle資料匯入匯出Oracle
- phpMyAdmin匯入/匯出資料PHP
- 大文字資料,匯入匯出到資料庫資料庫
- MySQL入門--匯出和匯入資料MySql
- MATLAB匯入資料Matlab
- 資料匯入終章:如何將HBase的資料匯入HDFS?
- Mongodb資料的匯出與匯入MongoDB
- oracle資料匯出匯入(exp/imp)Oracle
- 匯入和匯出AWR的資料
- EasyPoi, Excel資料的匯入匯出Excel
- Mysql 資料庫匯入與匯出MySql資料庫
- Excel 表匯入資料Excel
- MySQL資料的匯入MySql
- Oracle 資料匯入ExcelOracleExcel
- Oracle資料庫匯入匯出。imp匯入命令和exp匯出命令Oracle資料庫
- java程式碼實現excel檔案資料匯入JavaExcel
- PHP大資料xlswriter匯入匯出(最優資料化)PHP大資料
- Oracle資料泵匯出匯入(expdp/impdp)Oracle
- 【最佳實踐】MongoDB匯出匯入資料MongoDB
- SQL資料庫的匯入和匯出SQL資料庫
- Oracle資料泵的匯入和匯出Oracle
- 複雜「場景」資料匯入匯出
- 【oracle 資料匯入匯出字元問題】Oracle字元
- ClickHouse 資料表匯出和匯入(qbit)
- 小程式批次匯入excel資料,雲開發資料庫匯出cvs亂碼解決方案Excel資料庫
- Access 匯入 oracle 資料庫Oracle資料庫
- excel 匯入sqlyog資料庫ExcelSQL資料庫
- PHP匯入大量CSV資料PHP
- HIVE資料匯入基礎Hive
- 匯入excel 資料時間Excel
- NCF 如何匯入Excel資料Excel
- Oracle使用資料泵expdp,impdp進行資料匯出匯入Oracle