1

I'm using Laravel Valet with Craft 3 (Craft 3.0.0-RC13) and Sequel Pro.

I can't seem to get Craft to update. I just get a warning sign and a message saying that it couldn't back up the database.

When I looked at my log file, it contained the following:

FROM craft_info 2018-03-27 09:54:43 [127.0.0.1][1][-][error][craft\controllers\UpdaterController::actionBackup] Error backing up the database: The shell command "mysqldump --defaults-extra-file="/Users/richardclark/Sites/lorindafontainefarris/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="/Users/richardclark/Sites/lorindafontainefarris/storage/backups/lorinda-fontaine-farris_180327_135443_jfivi9ibwf_v3.0.0-rc16.1.sql" lorindafontainefarris && mysqldump --defaults-extra-file="/Users/richardclark/Sites/lorindafontainefarris/storage/runtime/temp/my.cnf" --add-drop-table --comments --create-options --dump-date --no-autocommit --routines --set-charset --triggers --no-create-info --ignore-table=lorindafontainefarris.craft_assetindexdata --ignore-table=lorindafontainefarris.craft_assettransformindex --ignore-table=lorindafontainefarris.craft_cache --ignore-table=lorindafontainefarris.craft_sessions --ignore-table=lorindafontainefarris.craft_templatecaches --ignore-table=lorindafontainefarris.craft_templatecachecriteria --ignore-table=lorindafontainefarris.craft_templatecacheelements lorindafontainefarris >> "/Users/richardclark/Sites/lorindafontainefarris/storage/backups/lorinda-fontaine-farris_180327_135443_jfivi9ibwf_v3.0.0-rc16.1.sql"" failed with exit code 127: sh: mysqldump: command not found 2018-03-27 09:54:43 [127.0.0.1][1][-][info][application] $_GET = [ 'p' => 'admin/actions/updater/backup'

I tried adding a PATH reference to my export PATH=$PATH:~/.local/bin/mysqldump in the .bash_profile file, but that didn't seem to do anything. Do I have to add something to the CraftValetDriver file, or is my PATH reference incorrect?

Any help would be greatly appreciated.

Thanks,

Richard

2 Answers 2

1

I believe we were conversing via Medium yesterday on this issue.

Regarding your question, I know for a fact your PATH reference is incorrect. The path to mysqldump is never ~/.local/bin/mysqldump; mine is located at /usr/local/bin/mysqldump (I'm using MariaDB).

BUT since you said on Medium that you're using MySQL (instead of MariaDB or another database option), you should use this instead: export PATH="/usr/local/mysql/bin:$PATH".

After you add that to your .bash_profile and either source the file or quit and relaunch terminal, mysqldump should be working.

1

I don’t know if the following will help with Valet, but I ran into the same problem today with my local Homebrew dev server. Despite having /usr/local/bin in my PATH and mysqldump working just fine on the command line the backup task would fail.

Checking the PHP info page revealed that Apache was running with a PATH setting of /usr/bin:/bin:/usr/sbin:/sbin. So there’s your problem.

After trying various different approaches for setting envvars and getting nowhere I eventually found that setting the PATH via the Apache launch daemon file did the job, per this SO thread and this gist.

For my setup this meant editing /usr/local/opt/httpd/homebrew.mxcl.httpd.plist and adding the following within the main <dict> tag:

  <key>EnvironmentVariables</key>
  <dict>
   <key>PATH</key>
   <string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
  </dict>

After adding that and running brew services restart httpd my PATH finally updated and the export task started working.

2
  • Just a note, great info for future reference but the OP is not using Apache since he's working with Laravel Valet which is Nginx only.
    – Jalen Davenport
    Mar 28, 2018 at 19:05
  • Ah thanks, I should have checked that. I’ll leave the post up in case it helps anyone else looking to fix this error with their Apache setup.
    – Dom Stubbs
    Mar 29, 2018 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.