Home > Database > Mysql Tutorial > body text

mysql数据库导出xml的实现方法

WBOY
Release: 2016-06-07 18:00:42
Original
1138 people have browsed it

因为有人问到如何将mysql数据库导出为xml文件,所以发现了这篇文章

D:\mysql-5.1.26-rc-win32\bin>mysql -X -utest test -e "select * from t1;" | tee f:\out.xml
代码如下:




1



2





-X 指定为xml格式
-utest test (指定用户名及数据库,这里没有密码)
"select * from t1;" 指定要执行的sql语句,不要忘了分号
| tee f:\out.xml (我这里用到了tee,输出导向,因为我的机器有mkt tools 工具箱,
所以Unix命令一样可以拿来用,不习惯的话,可以直接用 > 来直接导向到f:\out.xml,即mysql -X -utest test -e "select * from t1;" > f:\out.xml
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!