把mysql的数据导出成txt

把mysql的数据导出成txt

select a from b  into outfile '/sqlfile/a.txt';

my.ini里需要设置secure_file_priv = d:/sqlfile; linux中是/etc/my.conf,必须导出到配置的地方,导出到其他地方会报错;

Query OK, 2kw rows affected (1 min 33.86 sec)

 速度还是挺快的;

 如果导出到其他路径,会出现:

ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

提示;

mysql执行一个sql语句:

nohup mysql -uroot -proot -Dtest</home/root/test.mysql &
# -D表示使用的数据库
原文地址:https://www.cnblogs.com/stono/p/9177295.html