How does MySQL output output on the screen to a file?

Source: Internet
Author: User

1, if the MySQL server is the machine you want to export files, then you can directly use
Select ... into outfile
Statement.
Cases:
SELECT * from rank to outfile "/home/a.txt"

2, if the MySQL server is a separate machine, we are operating on a client, we want to import data results on the client machine. You can use the MYSQL-E statement.
Cases:
mysql-uroot-proot-p3310-h10.1.2.3 dbname-e "SELECT * from rank" >/home/a.txt



3. Use the MySQL tee (\ t) command, which is to input all MySQL output to the specified file.
Cases:

Mysql>tee/home/a.txtmysql>select * from Rank;mysql>exit


Mysql-uroot-p dbname-e "select * from User_role_new; Show profile CPU, block IO for query "> ~/aa.txt




Backup Command

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

How does MySQL output output on the screen to a file?

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.