Backing Up Views with Mysql Dump

前端 未结 7 2433
有刺的猬
有刺的猬 2020-12-08 10:02

I want to back up only the Views with mysqldump.

Is this possible?

If so, how?

7条回答
  •  旧巷少年郎
    2020-12-08 10:43

    By backup, I'm assuming you mean just the definition without the data.

    It seems that right now mysqldump doesn't distinguish between VIEWs and TABLEs, so perhaps the best thing to do is to either specify the VIEWs explicitly on the command line to mysqldump or figure out this list dynamically before mysqldump and then passing it down like before.

    You can get all the VIEWs in a specific database using this query:

    SHOW FULL TABLES WHERE table_type='view';

提交回复
热议问题