2 ways MySQL writes query results to a file

Source: Internet
Author: User

1.SELECT into Outfil:This method can not overwrite or append to the existing file, can only write to the new file, and establish the path of the file requires the MySQL process user has permission to create a new file. MySQL 61571 60876 Aug27? 3-10:58:08/usr/local/mysql/bin/mysqld--basedir=/usr/local/mysql--datadir=/data/ Mysqldata/data--plugin-dir=/usr/local/mysql/lib/plugin--user=mysql--log-error=/data/mysqldata/data/ Localhost.localdomain.err--pid-file=/data/mysqldata/data/localhost.localdomain.pid--socket=/data/mysqldata/ Mysql.sock--port=33096 MySQL ([email protected]: TIGER_ERP) >select * from Qqlh_code to outfile "/home/wy/mysql/qqlh_code_252.sql "
;
ERROR 1 (HY000): Can ' t create/write to file '/home/wy/mysql/qqlh_code_252.sql ' (Errcode:13-permission denied)
MySQL ([email protected]: TIGER_ERP) >select * from Qqlh_code to outfile "/home/mysql/qqlh_code_252.sql"; 2. Skillfully use pager redirect stdoutMySQL ([email protected]: TIGER_ERP) >pager cat >/home/wy/mysql/QQLH_CODE.sql;
PAGER set to ' Cat >/home/wy/mysql/qqlh_code.sql '
MySQL ([email protected]: TIGER_ERP) >select * from Qqlh_code;
6250 rows in Set (0.04 sec)
MySQL ([email protected]: tiger_erp) >nopager;

2 ways MySQL writes query results to a file

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.