[Solved] How can I specify new directory for saving backups?

Ok, I tried to ask this question in another thread but it eventually devolved into something else completely.

So, Her it is again…

Where in the system can I specify the directory for saving database backups?

Is it possible to do this as part of the “bench backup” command?

The default system saves backups to ~/frappe-bench/sites/[sitename]/private/backups/

I would like to know if I can change that in the system. Or even better, if I can specify that as part of the backup command.

Is there possibly an alternate way to do this? Like maybe running a backup command from inside MariaDB? Would that cause harm to ERPNext?

Looking for ideas here. Where in the code is the actual backup process?




Transfer to frappe:

Backup Utils:

File Paths:

@bhavikpatel7023 - Thank you for the code links. It certainly answered this part of the question:

Unfortunately, it doesn’t help me figure out how to run a backup from the command line and specify output file name and location.

The .py code reads well and offers some clues to the process, but I am not a developer. So, I am not able to figure out where to actually make changes to all those variables so they would allow me to get my desired results. Even though I found the variables in the code for specifying file name and path, I have no idea how I can influence their values.

Thank you though. It proved to be good reading and insightful to the overall process.

Still looking for an easy way (via command line) to execute an ERPNext database backup and specify the output file name and path.


Hiii bkm,

Right now there is no optional parameter for file path. But you can develop with optional path parameter.

Ok, that pretty much matches what I have found in the tons of research I did into the bench commands. Thank you, but I am not a developer so the “develop” option is out for me.

So, what MySql command can I use to run a valid ERPNext database backup?

At least from the mysql commands I can maybe force a file name and path.

Can anyone suggest the correct mysql syntax for this?


mysqldump -u YourUser -p YourDatabaseName > wantedsqlfile.sql

Ok, I finally solved this problem and detailed the steps to take in the following post:

The explanation in the above link solves this issue.