Search code examples
innodbmysqlmyisam

Backup MySQL database with MyISAM & InnoDB tables


I have a MySQL database with mixed up tables (MyISAM, InnoDB).

How can I create a full backup of the database with mysqldump via Linux command line, what option should I use?


Solution

  • use below-

    Generic command for all db's is-

    mysqldump -uroot -proot123 -A > /path/mydbbackup.sql
    

    If you want to take few or all db's as per your choice then-

    mysqldump -uroot -proot123 -B mydb1 mydb2 mydb3 > /path/mydbbackup.sql
    

    If you want to avoid locking then use single transaction option-

    mysqldump --single-transaction -uroot -proot123 -A > /path/mydbbackup.sql
    

    If you want to take specific db backup then-

    mysqldump -uroot -proot123 mydb > /path/mydbbackup.sql
    

    If you want to take a table backup then-

    mysqldump -uroot -proot123 mydb mytable > /path/mydbbackup.sql
    

    where username is root and password is root123, you can change as per your's

    Note: mysqldump utility takes innodb and myisam both backups.