使用load data infile来导入导出数据
2017-01-09 15:13
423 查看
先导出数据
mysql> select * from timer_gps_posinfo where time>'2017-01-01 00:00' and time <'2017-01-02 00:00' into outfile '/home/posinfo.txt' fields terminated by ',';报错:ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement解决:两种方法1.使用
mysql>SHOW VARIABLES LIKE "secure_file_priv"; +------------------+-----------------------+ | Variable_name | Value | +------------------+-----------------------+ | secure_file_priv | /var/lib/mysql-files/ | +------------------+-----------------------+ 1 row in set (0.00 sec)查看授权路径。2.禁用secure-file-priv可通过修改配置文件生效。再试
mysql> select * from timer_gps_posinfo where time>'2017-01-01 00:00' and time <'2017-01-02 00:00' into outfile '/var/lib/mysql-files/posinfo.txt' fields terminated by ','; Query OK, 4532130 rows affected (16.18 sec)成功导出,用时16秒。同一台机器,起了个docker-mysql,在新mysql中建立空数据库和表结使用
mysql> load data infile '/var/lib/mysql-files/posinfo.txt' into table timer_gps_posinfo fields terminated by ','; Query OK, 4532130 rows affected (17.28 sec) Records: 4532130 Deleted: 0 Skipped: 0 Warnings: 0导入完成。
相关文章推荐
- mysql使用load file导出导入[大]批量数据
- redis-dump-load数据导出导入备份工具使用介绍
- mysql如何使用load data infile导入中文数据
- mysql如何使用load data infile导入中文数据
- MySQL使用JDBC Load Data InFile导入数据注意事项
- 使用redis-dump-load工具导入导出redis数据
- 合理使用mysql中的load data infile导入数据
- Oracle数据导入导出(imp/exp)命令的使用
- 使用Transact-SQL进行数据导入导出方法
- Java 使用jxl.jar 导入导出Excel数据
- 使用Oracle 的 imp ,exp 命令实现数据的导入导出
- 使用T-SQL实现数据导出/导入(SQLSERVER—>SQLSERVER)
- 使用Transact-SQL进行数据导入导出方法详解
- Oracle 使用数据泵 expdp impdp 导入导出数据库“表空间”文件
- SQL SERVER使用OpenRowset,、OpenDataSource函数导入、导出数据到Excel 的几种方法(整理)
- 使用Transact-SQL进行数据导入导出方法详解
- 在pl/sql中使用exp/imp工具实现oracle数据导出/导入
- 使用Transact-SQL进行数据导入导出方法详
- 使用Transact-SQL进行数据导入导出方法详解
- 使用T-SQL实现数据导出\导入(SQLSERVER―>SQLSERVER)