mysqldump with db in a separate file

前端 未结 8 1695
生来不讨喜
生来不讨喜 2020-12-02 15:02

I\'m writing a single line command that backups all databases into their respective names instead using of dumping all in one sql.

Eg: db1 get saved to db1.sql and

8条回答
  •  难免孤独
    2020-12-02 15:28

    mysql -uroot -N -e 'show databases' | while read dbname; do mysqldump -uroot --complete-insert --some-other-options "$dbname" > "$dbname".sql; done
    

提交回复
热议问题