mysqldump without database name

筅森魡賤 提交于 2019-12-02 01:39:45

问题


Is it possible to dump data in xml format without the database name in the output?

If I dump output like this with the --xml option:

$>mysqldump --xml my_database_name my_table > my_table.xml

Then my output is something like

<?xml version="1.0"?>
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="my_database_name">
...

You can see the database name in the output which I do not want.

Is there an option to prevent that?


回答1:


I don't think there is such option for the mysqldump command. After generating the XML file, you can always use a script to get rid off the database tags from the dump file. In Windows' PowerShell you could always use the following command:

${c:my_table.xml} -replace "`<database name=`"my_database_name`"`>" -replace "`<\database`>" > my_table_new.xml


来源:https://stackoverflow.com/questions/12935379/mysqldump-without-database-name

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!