Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Install mysqldump (MariaDB or mysql client?) to the Unraid OS for user script

Featured Replies

I have installed the user.scripts plugin, which is very useful, and have copied across a backup script (originally written for MySQL, but reusing here for my new MariaDB docker container).

 

It errors with:

 

/tmp/user.scripts/tmpScripts/mariadb-backup/script: line 11: mysqldump: command not found

 

Under which environment and user is this executing? I am assuming on the Unraid's OS itself and as `root`.

 

Solved by explosionhole

  • Community Expert
1 hour ago, explosionhole said:

Under which environment and user is this executing? I am assuming on the Unraid's OS itself and as `root`.

Yes. Unraid isn't going to have that command, and likely it is missing a lot of dependencies even if you could install the command.

 

Maybe it would run in your mariadb container. You can get to the command line inside a container by clicking its icon and selecting >_ Console.

 

If you can get it working inside that container, then it should be possible to make User Scripts run it inside that container.

  • Author

thanks for the pointer.

 

when selecting the deployed Mariadb-Official container, so view it's config it actually lists a command to perform backups, which they have as:

 

docker exec MariaDB-Official sh -c 'exec mysqldump --all-databases -uroot -p"YOUR_ROOT_PASSWORD"' > /mnt/user/Backups/all-databases.sql

 

Which I tried, by adding a new "bind" volume to the container's config and pointing the paths. Now I get "permission denied", presumably the local user this is running as within this container doesn't have permissions to my new "bind" volume. I cannot identify which user I am on the container's console.

 

docker exec mariadb sh -c 'exec mysqldump --all-databases -uroot -p"YOUR_ROOT_PASSWORD" | gzip > /backups/unraid_`date '+%d-%m-%Y'`.sql.gz'

 

 

  • Community Expert
3 minutes ago, explosionhole said:
docker exec MariaDB-Official sh -c 'exec mysqldump --all-databases -uroot -p"YOUR_ROOT_PASSWORD"' > /mnt/user/Backups/all-databases.sql

This command is for running on Unraid. It executes a command in the container and sends the results to a path on Unraid.

  • Author
1 hour ago, trurl said:

This command is for running on Unraid. It executes a command in the container and sends the results to a path on Unraid.

I know this.

 

What I don't (off-hand) understand is the user and permission model for Unraid with Docker containers.

 

If this was a pure Docker (or other container platform), I would use newer "volumes" not "bind volumes". However, adopting to a new platform, I am trying to follow the typical patterns that follows the Unraid GUI.

 

 

 

  • Author
  • Solution

I deleted all of the mounts and directories on the Unraid server and inside the MariaDB container too. Then recreated it, and seems to be working as above. Not sure which permission was causing the issue, might have been the first output file and afterwards the script would need to update an existing file.

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.