How to export xml from a mysql database

Source: Internet
Author: User

D: \ mysql-5.1.26-rc-win32 \ bin> mysql-X-utest test-e "select * from t1;" | tee f: \ out. xml
Copy codeThe Code is as follows:
<? Xml version = "1.0"?>

<Resultset statement = "select * from t1" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance">
<Row>
<Field name = "id"> 1 </field>
</Row>

<Row>
<Field name = "id"> 2 </field>
</Row>
</Resultset>



-X: xml format
-Utest (specify the user name and database, and there is no password here)
"Select * from t1;" specifies the SQL statement to be executed. Do not forget the semicolon.
| Tee f: \ out. xml (tee is used here for output orientation, because my machine has the mkt tools toolbox,
Therefore, Unix commands can be used in the same way. If you are not used to them, you can directly use> to direct them to f: \ out. xml, that is, mysql-X-utest test-e "select * from t1;"> f: \ out. xml

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.