webdevops / php-docker-boilerplate

:stew: PHP Docker Boilerplate for Symfony, Wordpress, Joomla or any other PHP Project (NGINX, Apache HTTPd, PHP-FPM, MySQL, Solr, Elasticsearch, Redis, FTP)
https://webdevops.io/projects/php-docker-boilerplate/
MIT License
562 stars 186 forks source link

Mysql Backup fail #51

Closed guiyomh closed 7 years ago

guiyomh commented 8 years ago

when i run make mysql-backup i have this error :

Found Makefile directory: /home/vagrant/projects/drupal8
 * Starting MySQL backup...
mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) when trying to connect
Makefile:41: recipe for target 'mysql-backup' failed
make: *** [mysql-backup] Error 2

  [CliTools\Exception\CommandExecutionException]
  Process make did not finished successfully

make

a solution to fix it, is to udpdate the bin/backup.sh to add user, host and password :

dockerExec  mysqldump -h mysql -u dev -pdev database --opt --single-transaction --events --routines --comments

or add my.cnf

tbal commented 7 years ago

I'm facing the same issue (with https://github.com/webdevops/TYPO3-docker-boilerplate/). But I think the source of the problem is the same: There is a template file for the mysql config file 'my.cnf' which sets default values for connection, so that host/user/passwd can be omitted when using mysql client or mysqldump. But it seems that this file isn't provisioned at any time, so the default values are not set. This is why the connection without any parameters fails. I'm sure this once worked well but may get lost somewhen (I saw some refactoring commits in october 2015..).

tbal commented 7 years ago

Problem is the same for mysql restore..

guiyomh commented 7 years ago

hi @tbal, they are a PR #54 to fix it. Please, wait that it's merge by @mblaschke