mysql怎么导出数据到本地文件
把test_time表中的数据导出成txt 文件
(推荐教程:mysql数据库学习教程)
mysql> show global variables like '%secure%'; +--------------------------+-----------------------+ | Variable_name | Value | +--------------------------+-----------------------+ | require_secure_transport | OFF | | secure_auth | ON | | secure_file_priv | /var/lib/mysql-files/ | 这个是导出目录 +--------------------------+-----------------------+ 3 rows in set (0.01 sec)
进行导出操作:
mysql> select * from test_time into outfile '/var/lib/mysql-files/test_time.txt'; Query OK, 1 row affected (0.00 sec)
会在目录下生成数据文件:
[root@master mysql-files]# more test_time.txt 1 no 2019-03-26 11:29:04 2019-03-26 11:30:55
来源:PY学习网:原文地址:https://www.py.cn/article.html