I can't create a backup on my setup. When I update craft3 I got an error message that says that the backup can't be created, proced anyway? I always click ok. The same error on the database backup utilitie.
The error in the log is:
Could not create backup: The shell command "cd "mysqldump --defaults-extra-file=C:\MAMP\htdocs\craft3.personal\storage\runtime\temp\my.cnf --add-drop-table --comments --create-options --dump-date --no-autocommit --routines --set-charset --triggers --result-file=C:\MAMP\htdocs\craft3.personal\storage\backups" && craft3personal_170622_132151_vqiaodbwld_v3.0.0-beta.19.sql craft3.personal" failed with exit code 1. in C:\MAMP\htdocs\craft3.personal\vendor\craftcms\cms\src\controllers\UtilitiesController.php:375
I also have debugged a little bit on PHPstorm and I noticed that the credentials created in the tem/my.cnf file could be wrong. I have mysql on a different port, I can't update the port on the .env file, this is the tem/my.cnf file generated:
[client]
user=xxxx
password=xxxxx
host=127.0.0.1:8889
port=3306
and this is my .env file (how can I update the mysql port? i just added the port in the url)
# The database driver that will used ('mysql' or 'pgsql')
DB_DRIVER="mysql"
# The database server name or IP address (usually this is 'localhost' or '127.0.0.1')
DB_SERVER="127.0.0.1:8889"
# The database username to connect with
DB_USER="xxxx"
# The database password to connect with
DB_PASSWORD="xxxxx"
# The name of the database to select
DB_DATABASE="craft3.personal"
# The database schema that will be used (PostgreSQL only)
DB_SCHEMA="public"
# The prefix that should be added to generated table names (only necessary if multiple things are sharing the same database)
DB_TABLE_PREFIX=""
Please let me know if I can help with anything else :)
If you make this change to your config/db.php file, add the DB_PORT env variable, then remove the port from your DB_SERVER setting, this should work.
Thanks @takobell I was able to setup the port. I'm still getting the backup error, I noticed your bug report on php-shellcommand So I commented out the next lines:
/*
if ($this->getIsWindows()) {
// Make sure to switch to correct drive like "E:" first if we have a full path in command
$chdrive = (isset($command[1]) && $command[1]===':') ? $command[0].': && ' : '';
$command = sprintf($chdrive.'cd %s && %s', escapeshellarg(dirname($command)), basename($command));
}
*/
The backup is working after that fix, looking forward to get an official fix for this issue. FYI: I have mysqldump on the path variables of windows.
Thanks, @andrelopez... pinged that php-shellcommand issue/pull request to see if I get can movement on it.
@takobell Any effort being made to add the ability to backup "remote" connections if mysqldump bin isn't on the same machine as the one running the web server?
I'm running Craft in a docker-compose project with Mariadb, PHP-FPM and Nginx -- one process per container.
This isn't a blocker as I'll be able to work around it via shared volume mounts (hence commenting on an old ticket and not opening a new issue), but wanted to document my use case as I'm sure it will become a reoccuring issue as devs migrate from Vagrant (or even local hosts) to Docker.
@nikolowry I had the same issue in a docker-compose Craft 3 project.
The way I solved it was to just install the mysql-client package as part of the web service image.
If it helps, this is what the Dockerfile for my Craft 3 web service looks like:
FROM ubuntu:xenial
ENV DEBIAN_FRONTEND=non-interactive
# Install dependencies
RUN apt-get update && apt-get install -y \
apache2 \
php libapache2-mod-php \
php-mcrypt php-mysql php-mbstring php-dom php-zip \
curl php-curl \
imagemagick php-imagick \
mysql-client
# PHP config
COPY ./php.ini /etc/php/7.0/apache2/
# Apache config
RUN a2enmod rewrite
COPY ./apache2.conf /etc/apache2/
COPY ./vhost.conf /etc/apache2/sites-enabled/000-default.conf
CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
If your .env is already set up properly (namely DB_SERVER is set to the name of your db service in your docker-compose file), you should be 馃憣.
Most helpful comment
@takobell Any effort being made to add the ability to backup "remote" connections if
mysqldumpbin isn't on the same machine as the one running the web server?I'm running Craft in a docker-compose project with Mariadb, PHP-FPM and Nginx -- one process per container.
This isn't a blocker as I'll be able to work around it via shared volume mounts (hence commenting on an old ticket and not opening a new issue), but wanted to document my use case as I'm sure it will become a reoccuring issue as devs migrate from Vagrant (or even local hosts) to Docker.