Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database backup fails with exit code 1 #2874

Closed
echantigny opened this issue May 11, 2018 · 8 comments
Closed

Database backup fails with exit code 1 #2874

echantigny opened this issue May 11, 2018 · 8 comments
Assignees

Comments

@echantigny
Copy link
Contributor

echantigny commented May 11, 2018

Description

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.

Steps to reproduce

  1. Just click on the Database Backup button
  2. I added mysqldump path to the PATH variable and then rebooted, with same result.

Additional info

  • Craft version: Craft Pro 3.0.8
  • PHP version: 7.2.4
  • Database driver & version: MySQL 5.7.21
  • Plugins & versions: Redactor 2.0.1

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
@echantigny
Copy link
Contributor Author

echantigny commented May 11, 2018

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"

@angrybrad angrybrad self-assigned this May 11, 2018
@angrybrad
Copy link
Member

angrybrad commented May 16, 2018

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.

@echantigny
Copy link
Contributor Author

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.

@echantigny
Copy link
Contributor Author

Please note that I am now running Craft 3.0.8 with same issue.

@angrybrad
Copy link
Member

angrybrad commented May 16, 2018

@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 support@craftcms.com?

@echantigny
Copy link
Contributor Author

@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.

@echantigny
Copy link
Contributor Author

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.

@angrybrad
Copy link
Member

add_to_path_thumb

For the more visual learners. ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants