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

Laradock and Spatie Backup – mysqldump command not found #644

Closed
darkostanimirovic opened this issue Feb 28, 2017 · 11 comments
Closed

Laradock and Spatie Backup – mysqldump command not found #644

darkostanimirovic opened this issue Feb 28, 2017 · 11 comments

Comments

@darkostanimirovic
Copy link

Hi, I'm new to Docker so this may be a bit basic. I want to use Spatie Backup (https://github.com/spatie/laravel-backup) but it needs access to mysqldump. Of course, mysqldump is only available under mysql container, not workspace. By default, spatie/laravel-backup takes current database configuration, so shouldn't mysqldump be available, as it runs on the same exposed port as mysql, i.e. laradock_mysql?
Thanks.

@hasangilak
Copy link

open up your workspace/Dockerfile and add these lines to it

#
#--------------------------------------------------------------------------
# mysql-client
#--------------------------------------------------------------------------
#

USER root

RUN apt update && \
    apt install -y mysql-client

down your containers
docker-compose down
then rebuild workspace just by
docker-compose build workspace
and re-up you containers for example
docker-compose up redis nginx mysql

@darkostanimirovic
Copy link
Author

Thanks, that does it. I thought maybe there's a way to not install mysql cli inside of workspace, but that works as well. Cheers!

@ohblue
Copy link

ohblue commented Dec 25, 2017

i got a error, when i run apt install -y mysql-client in workspace bash.

E: Unable to locate package mysql-client

@hasangilak
Copy link

hasangilak commented Dec 25, 2017

@ohblue run apt update first

@ohblue
Copy link

ohblue commented Dec 26, 2017

my apt install command just after apt update

@ryancwalsh
Copy link

Thank you, @hasangilak . That was helpful. I agree with @Dartanjan :

"I thought maybe there's a way to not install mysql cli inside of workspace, but that works as well."

@azaricstefan
Copy link

I had this same issue but in order to solve it completely you have to add this same lines to the php-fpm/Dockerfile too.

I had the same problem when I created new backup from Laravel Backpack Backup UI . This snippet which install mysql client solves error which was showing up.

open up your workspace/Dockerfile and add these lines to it

#
#--------------------------------------------------------------------------
# mysql-client
#--------------------------------------------------------------------------
#

USER root

RUN apt update && \
    apt install -y mysql-client

down your containers
docker-compose down
then rebuild workspace just by
docker-compose build workspace
and re-up you containers for example
docker-compose up redis nginx mysql

@NicksonYap
Copy link

in newer laradock .env, you can now use: WORKSPACE_INSTALL_MYSQL_CLIENT=false

@ryancwalsh
Copy link

I noticed that for all my daily backups since 2019-08-18, the zip files in S3 have been tiny: “444.0 B” (444 bytes). For hours, I looked into possible problems with permissions, configs, caching, etc.

When I unzipped the tiny backup zip file, these were the only lines:

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

(It’s 1,025 bytes uncompressed. )

The good news is that my backups are now working again. But I'm not sure why.

My guess is that it started working after installing mysql on workspace and php-fpm (#644 (comment)) and then service docker restart.

@rvanbaalen
Copy link

@ohblue I ran into that error as well. Found a SO post explaining that the package is called default-mysql-client now.

apt-get install default-mysql-client inside my PHP container did the trick and installed MySQL and, what I came for, mysqldump.

@Girevik1
Copy link

If you are using postgresql that add
RUN apt update && apt install -y postgresql-client
in your php Dockerfile

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

8 participants