mysqlimport命令_MySQL命令详解:mysqlimport MySQLimport位于MySQL/bin⽬录中,是MySQL的⼀个载⼊(或者说导⼊)数据的⼀个⾮常有效的命令⾏⼯具。 使⽤mysqlimport -?命令,可以查看mysqlimport的具体参数及详细说明。下表是⼀些常见的选项: -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. 压缩在客户端和服务器之间发送的所有信息(如果⼆者均⽀持压缩)
-d, --delete First delete all rows from table. 新数据导⼊数据表中之前删除数据数据表中的所有信息
--fields-terminated-by=name Fields in the textfile are terminated by … 指定数据之间的分隔符。默认的分隔符是跳格符(Tab)
顺序表和链表的优缺点--fields-enclosed-by=name Fields in the importfile are enclosed by ... 指定⽂本⽂件中数据的记录是以什么括起的, 很多情况下数据以双引号括起。 默认的情况下数据是没有被字符括起的
--fields-optionally-enclosed-by=name Fields in the i.file are opt. enclosed by … 字段包括符,只⽤在CHAR和VERCHAR字段上
c语言从大到小排序
--fields-escaped-by=name Fields in the i.file are escaped by ... 转义字符
-f, --force Continue even if we get an sql-error. 不管是否遇到错误,MySQLimport将强制继续插⼊数据
-?, --help Displays this help and exits. 显⽰帮助消息并退出
-h, --host=name Connect to host. 将数据导⼊给定主机上的MySQL服务器。默认主机是localhost
panelook屏库-i, --ignore If duplicate unique key was found, keep old row. 跳过或者忽略那些有相同唯⼀关键字的⾏, 导⼊⽂件中的数据将被忽略
--ignore-lines=# Ignore first n lines of data infile. 忽视数据⽂件的前n⾏
--lines-terminated-by=name Lines in the i.file are terminated by ... ⾏记录分隔符。 默认的情况下MySQLimport以newline为⾏分隔符
-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. 提⽰输⼊密码
mysql面试题详解-W, --pipe Use named pipes to connect to server. 使⽤命名管道连接服务器
-P, --port=# Port number to use for connection or 0 for default to, in order of preference, myf, $MYSQL_TCP_PORT,
/etc/services, built-in default (3306). ⽤于连接的TCP/IP端⼝号
--protocol=name The protocol of connection (tcp,socket,pipe,memory). 连接使⽤的协议
-r, --replace If duplicate unique key was found, replace old row. 与-i选项的作⽤相反;此选项将替代表中有相同唯⼀关键字的记录
--shared-memory-base-name=name Base name of shared memory. 共享内存连接名。该选项只⽤于Windows
-s, --silent Be more silent. 沉默模式。只有出现错误时才输出
smart意思 时髦-S, --socket=name Socket file to use for connection. 当连接localhost时使⽤的套接字⽂件(为默认主机)
--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. 连接服务器时MySQL使⽤的⽤户名
-v, --verbose Print info about the various stages. 冗长模式。打印出程序操作的详细信息
-V, --version Output version information and exit. 显⽰版本(version)
⽰例:
shell> mysql -e 'CREATE TABLE imptest(id INT, n VARCHAR(30))' test shell> ed a 100 Max Sydow 101 Count Dracula . 32 q shell> od - 0000000 1 0 0 \t M a x S y d o w \n 1 0 0000020 1 \t C o u n t D r a c u l a \n 0000040 shell> mysqlimport --local test.imptest: Records: 2 Deleted: 0 Skipped: 0 Warnings: 0 shell> mysql -e 'SELECT * FROM imptest' test +------+---------------+ | id | n | +------+---------------+ | 100 | Max Sydow | | 101 | Count Dracula | +------+---------------+jquery效果代码
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论