把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表示使用的数据库

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM