mysql——表的导出——用mysqldump命令导出 xml文件
语法格式:mysqldump -u root -ppassword --xml | -X dbname table > 路径文件名 注意:后面不能有 ; 号,不然会报错。X大小写都可以
方法一:
mysqldump -u root -p123 --xml see cr01 > C:\Users\del\Desktop\s.xml
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <database name="see"> <table_structure name="cr01"> <field Field="sx" Type="int(50)" Null="YES" Key="" Extra="" Comment=""/> <field Field="mz" Type="varchar(50)" Null="YES" Key="" Extra="" Comment=""/> <field Field="bz" Type="varchar(50)" Null="YES" Key="" Extra="" Comment=""/> <options Name="cr01" Engine="InnoDB" Version="10" Row_format="Compact" Rows="7" Avg_row_length="2340" Data_length="16384" Max_data_length="0" Index_length="0" Data_free="6291456" Create_time="2019-12-26 15:12:47" Collation="latin1_swedish_ci" Create_options="" Comment=""/> </table_structure> <table_data name="cr01"> <row> <field name="sx">1</field> <field name="mz">sww</field> <field name="bz">sww01</field> </row> <row> <field name="sx">2</field> <field name="mz">aww</field> <field name="bz">aww02</field> </row> <row> <field name="sx">3</field> <field name="mz">qww</field> <field name="bz">qww03</field> </row> <row> <field name="sx">4</field> <field name="mz">eww</field> <field name="bz">eww04</field> </row> <row> <field name="sx">5</field> <field name="mz">rww</field> <field name="bz">rww05</field> </row> <row> <field name="sx">6</field> <field name="mz">yww</field> <field name="bz">yww06</field> </row> <row> <field name="sx">7</field> <field name="mz">uww</field> <field name="bz">uww07</field> </row> </table_data> </database> </mysqldump>
方法二:
mysqldump -u root -p123 -X see cr01 > C:\Users\del\Desktop\s.xml 注意:x大小写都可以