mysqlimport

mysqlimport 是客户端数据导入工具,用来导入 mysqldump 加 -T 参数后导出的文本文件。

语法

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

示例

mysqlimport -u root -p test /var/lib/mysql-files/EMP.txt

# 数据文本文件名一定要和数据库中的表名一致

# 当遇到如下报错:
# mysqlimport: Error: 1290, The MySQL server is running with the --secure-file-priv option
# so it cannot execute this statement, when using table: EMP
# 使用 show variables like '%secure%' 查询 secure_file_priv 对于的目录
# 导入文本文件放置到上边查到的目录中即可

Last updated