MySQL - Best command to backup database

By xngo on August 11, 2019

Best command to backup MySQL database

mysqldump --hex-blob --extended-insert=false --complete-insert=true -uUSERNAME -pPASSWORD DATABASENAME > backup.sql
--hex-blob
Ensure that blob columns are exported correctly. MySQL will convert BLOB to hexadecimal.
--extended-insert=false and --complete-insert=true
Ensure that when backup.sql is imported back, it uses less memory. MySQL will generate a separate INSERT query for every record in every table instead of only generating one INSERT command per table.

If you think you have a better command, please comment.

About the author

Xuan Ngo is the founder of OpenWritings.net. He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.