I want to back up all of my MySQL databases regularly. I have around 50 databases. It’s boring to take all the database backup one by one. Is there any way I can export all the databases with a single command? And later import all of them into my MySQL server.
You can export all the databases with the following command.
mysqldump -u root -p --all-databases > alldb.sql
You can exclude locked tables just by adding the option
mysqldump -u root -p --all-databases --skip-lock-tables > alldb.sql
mysql -u root -p < alldb.sql