Mysqldump more than one table?

前端 未结 2 745
萌比男神i
萌比男神i 2021-02-01 23:03

How can I use mysqldump to dump certain tables that start with common prefix?

2条回答
  •  臣服心动
    2021-02-02 00:01

    Hehe, this is kind of a hack, but it works (using bash):

    mysqldump -u USER -p DATABASE $(mysql -u USER -p -D DATABASE -Bse "show tables like 'PREFIX%'") > /tmp/DATABASE.out
    

    Change the ALLCAPS words as needed.

提交回复
热议问题