Backing Up Views with Mysql Dump

前端 未结 7 2412
有刺的猬
有刺的猬 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:33

    Thanks for this - very useful.

    One hiccup though - perhaps as I have a slightly convoluted set of views that reference other views etc:

    I found that the "definer" user needs to exist and have the right permissions on the target schema, otherwise mysql will not generate the views that reference other views as it things definitions are insufficient.

    In the generated:

    /*!50013 DEFINER=@ SQL SECURITY DEFINER */

    --> ensure @ is ok on your target instance, or replace this string with a user that does.

    Thanks Thorstein

提交回复
热议问题