I'm trying to do a database backup, but I keep getting Exit code 1 on both my local (WampServer on Windows 10) and on the production server which is on IIS.
The response is:
{"error":"Could not create backup: The shell command \"mysqldump --defaults-extra-file=\"C:\\wamp64\\www\\ccm\\craft\\storage\\runtime\\temp\\my.cnf\" --add-drop-table --comments --create-options --dump-date --no-autocommit --routines --set-charset --triggers --single-transaction --no-data --result-file=\"C:\\wamp64\\www\\ccm\\craft\\storage\\backups/canadian-judicial-council_180511_153726_mfo8hicb1w_v3.0.7.sql\" ccm && mysqldump --defaults-extra-file=\"C:\\wamp64\\www\\ccm\\craft\\storage\\runtime\\temp\\my.cnf\" --add-drop-table --comments --create-options --dump-date --no-autocommit --routines --set-charset --triggers --no-create-info --ignore-table=ccm.assetindexdata --ignore-table=ccm.assettransformindex --ignore-table=ccm.cache --ignore-table=ccm.sessions --ignore-table=ccm.templatecaches --ignore-table=ccm.templatecachecriteria --ignore-table=ccm.templatecacheelements ccm >> \"C:\\wamp64\\www\\ccm\\craft\\storage\\backups/canadian-judicial-council_180511_153726_mfo8hicb1w_v3.0.7.sql\"\" failed with exit code 1."}
The log error:
2018-05-11 11:37:26 [::1][1][-][error][yii\base\Exception] yii\base\Exception: Could not create backup: The shell command "mysqldump --defaults-extra-file="C:\wamp64\www\ccm\craft\storage\runtime\temp\my.cnf" --add-drop-table --comments --create-options --dump-date --no-autocommit --routines --set-charset --triggers --single-transaction --no-data --result-file="C:\wamp64\www\ccm\craft\storage\backups/canadian-judicial-council_180511_153726_mfo8hicb1w_v3.0.7.sql" ccm && mysqldump --defaults-extra-file="C:\wamp64\www\ccm\craft\storage\runtime\temp\my.cnf" --add-drop-table --comments --create-options --dump-date --no-autocommit --routines --set-charset --triggers --no-create-info --ignore-table=ccm.assetindexdata --ignore-table=ccm.assettransformindex --ignore-table=ccm.cache --ignore-table=ccm.sessions --ignore-table=ccm.templatecaches --ignore-table=ccm.templatecachecriteria --ignore-table=ccm.templatecacheelements ccm >> "C:\wamp64\www\ccm\craft\storage\backups/canadian-judicial-council_180511_153726_mfo8hicb1w_v3.0.7.sql"" failed with exit code 1. in C:\wamp64\www\ccm\craft\vendor\craftcms\cms\src\controllers\UtilitiesController.php:383
And to get this out of the way, this is what I get if I try to use mysqldump in the command prompt
C:\Users\User>mysqldump
Usage: mysqldump [OPTIONS] database [tables]
OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR mysqldump [OPTIONS] --all-databases [OPTIONS]
For more options, use mysqldump --help
Running the exact same command in the prompt, removing the defaults-extra-file and adding my user "root", works.
mysqldump --user root --add-drop-table --comments --create-options --dump-date --no-autocommit --routines --set-charset --triggers --single-transaction --no-data --result-file="C:\wamp64\www\ccm\craft\storage\backups/canadian-judicial-council_180511_153726_mfo8hicb1w_v3.0.7.sql" ccm && mysqldump --user root --add-drop-table --comments --create-options --dump-date --no-autocommit --routines --set-charset --triggers --no-create-info --ignore-table=ccm.assetindexdata --ignore-table=ccm.assettransformindex --ignore-table=ccm.cache --ignore-table=ccm.sessions --ignore-table=ccm.templatecaches --ignore-table=ccm.templatecachecriteria --ignore-table=ccm.templatecacheelements ccm >> "C:\wamp64\www\ccm\craft\storage\backups/canadian-judicial-council_180511_153726_mfo8hicb1w_v3.0.7.sql"
Curious... do you get the exact same failed with exit code 1 error on production using IIS or just locally using Wamp? Using Win10/IIS locally and I just had to add mysqldump/pg_dump paths to the PATH environment variables so PHP/IIS could access them.
Maybe production backups are still failing, but it's with a different error message.
Hi @angrybrad
Yes, I'm still getting the exact same error on IIS on a Win Server 2012 r2 setup. Did the same tests without any issues there too, with mysql/bin in the PATH variable.
Something that might be worth nothing, this is a site that I upgraded from Craft 2 to 3, keeping the Craft 2 file structure. Might, or might not be part of the equation, but I thought you should know.
Please note that I am now running Craft 3.0.8 with same issue.
@echantigny any chance we could get some CP and (s)FTP/SSH credentials to that box to poke around a bit? If so, could you send to [email protected]?
@angrybrad Sorry, I can't give you access to that box. Confidential information and all that on my client's box.
We could do a screen share on my box if you want (I have the same issue), and we can remote in to that box if needed. Not sure how well that would work, but we can try if it helps.
You can get me on your Slack team with eric.chantigny if you want to chat live.
Thanks to Brad, we figured this one out on WAMP. The issue was the PATH variable containing the mysqldump path was the current user's Path, and not the System variables path. Adding mysqldump to the system Path variable solved the issue on WAMP.

For the more visual learners. ^
Most helpful comment
For the more visual learners. ^