MySQL Export CSV format report under Linux environment

Source: Internet
Author: User

In general, the Linux system will not be used to use MySQL, after all, there is no such as mysqlfront such as the ready-made Operation tool. But the product of the online server is a Linux server, no way, can only bite the Bullet code shell statement to operate.

The general statements are as follows:

" The SQL statement you need "  > File Output Location

-U is the MySQL user name,-H is the host address (if the operation can write "localhost", remote words can only write IP address or domain name),-e does not run SQL in the MySQL prompt environment (of course you have to enter the password every time!) )

There are a few points to note:

1. "" "in the SQL statement can not take" ' ", that is, the ESC key and the TAB key between the key, I tried to add it, the result is to execute the statement after the program has been suspend there, if the SQL statement field has special meaning characters such as" sum ", also had to change the name of the way ~ ~

2. There can be no carriage return keyboard in the SQL statement, or the system will use the statement before the ENTER key as the input statement, this is very pit dad, every time you write a SQL statement and one line to rearrange it again. There is no good way, some words will be updated to the blog!

3. Where "file output location" can be a nonexistent file, the statement will automatically create and inject query results for you, currently only tried CSV file, xls format file has not been tried, if you want to convert the output CSV file to XLS, first use Excel's self-text function to format the CSV file, Then save the file as Excel format.

MySQL Export CSV format report under Linux environment

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.