# mysqldump replacement or correct options?



## Buck (Oct 28, 2022)

I'm not too skilled in SQL software in general and always relied on mysqldump command to do complete and comprehensive "snapshot-type" backup of everything. However I found out recently that it doesn't work properly on some complex databases, such as the one created by Magento. Backups would be missing some important internal logic without which it's impossible to restore the database to its original state. I know that my desktop clients perform such backups without problems using default settings. Therefore the question is if there are some specific arguments I should append to mysqldump or if there's a decent replacement for mysqldump in the ports.


----------



## Alain De Vos (Oct 28, 2022)

I'm not too skilled also , but i would do

```
mysqldump -u root -p --all-databases > mydump.sql
```
This backups data & structure.

Possible additional flags when performing mysqldump. This dumps "everything"

```
--lock-all-tables  --events  --routines  --triggers
```

Cfr,





						MySQL :: MySQL 8.0 Reference Manual :: 7.4.5.3 Dumping Stored Programs
					






					dev.mysql.com
				




Restore with

```
mysql -u root -p < mydump.sql
```


----------



## Datapanic (Oct 29, 2022)

Take a look at databases/xtrabackup.


----------



## Buck (Nov 1, 2022)

I've also found a previously unknown MySQL utility called mysqlpump. Haven't had the chance to evaluate it yet but the dumps generated by it have a different structure.





						MySQL :: MySQL 8.0 Reference Manual :: 4.5.6 mysqlpump — A Database Backup Program
					






					dev.mysql.com


----------

