Can't create database dump


I’m attempting to create a database dump using the backup plugin, but I’m encountering the following error:

"sh: 1: /usr/bin/mysqldump: not found"

I’m testing with the variables placed directly in the file, like this:

dump = "/usr/bin/mysqldump -h xxxxxx -u xxxxxx -pxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxx"

I’m running the application using Docker Compose. The app operates within a container built upon the php:7.4-fpm image, while the database runs in another container using the mariadb:10.2 image. Although the app is publicly accessible through Nginx, which acts as a reverse proxy, the database container is not.

I’m using OMP 3.3.0 and the Backup plugin in its version.

Could anyone please help me with this issue?

Hi @willi.piske Welcome to the community! :smiley:

What the plugin tells you to do is to configure the path of your server where mysqldump will run.

  1. Edit the file, this file is in the root of the OMP installation folder.

  2. Locate this code and try with the dump instruction that I put you below

; External Commands ;


; These are paths to (optional) external binaries used in
; certain plug-ins or advanced program features.

; Using full paths to the binaries is recommended.

; tar (used in backup plugin, translation packaging)
tar = /bin/tar

; mysqldump
dump = " /usr/local/mysql/bin/mysqldump -h {$hostname} -u {$username} -p {$password} {$databasename}"

The “$tokens” must be replaced with your database server information, in this order:

  1. Database hostname
  2. Database username
  3. Database password
  4. Database name

Note that this involves specifying the database password in the command line, which may be a security concern.

Hi @willi.piske,

Just to add – I think the problem is that the mysqldump binary isn’t available inside the Docker container. I’ll tag @marc in case he has any suggestions – he’s one of our resident Docker experts.

Alec Smecher
Public Knowledge Project Team

1 Like

As Alec says, looks like mysqldump does not exist in the OMP container.

To get out of doubt, login to the container (docker exec -it <containerName> sh) and then run "/usr/bin/mysqldump".

If it does not find it, you can install it (ie: apt-get install mysql-client) and try again.
If everything works, you will have to redo your OMP image to include mysql-client.

By the way, I am starting to create “official” images for OMP.
If you are interested in the subject, maybe we can build them together?

Best regards,

I mean mysqldump is available in the mariadb container. Wouldn’t it make sense to just show the snippet and run it there?

Containers are isolated so you can’t run from the ojs app container the mysqldump binary of the mariadb one.

As an old school sysadmin I empathize with the concern of duplicate stuff (now days people don’t seam much worried about this kind of things) and this is why I don’t use the dump built in in OJS and I create the dumps by my own (with a “docker exec” call in the host’s crontab).