Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings
wp-cli

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How can I force wp-cli db to use mysqldump? #6103

Unanswered
s-allius asked this question in How do I?
How can I force wp-cli db to use mysqldump? #6103
Jul 3, 2025 * 1 comment
Return to top
Discussion options

s-allius
Jul 3, 2025

Hi,
my Webhosting only offers a /usr/bin/mysqldump. But wp-cli detection use the mariadb-dump.

Is it possible to force the using of mysqldump? Maybe with an environment variable?

Auto detection is a good idea, but seems to be wrong in my setup

mysql --version prints
mysql Ver 15.1 Distrib 10.5.29-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper

You must be logged in to vote

Replies: 1 comment

Comment options

manhphuc
Dec 10, 2025

Hi!

I've opened a PR that adds full support for forcing mysqldump (or any custom dump binary) via the WP_CLI_MYSQLDUMP environment variable.

PR #6165 - Add robust support for WP_CLI_MYSQLDUMP override:
#6165

This update allows you to:

  • Force /usr/bin/mysqldump even on MariaDB systems
  • Override the dump client using either an absolute path or a plain command name
  • Avoid failures when an invalid or non-executable path is provided
  • Fall back safely to mariadb-dump or mysqldump when needed

Example usage:

WP_CLI_MYSQLDUMP=/usr/bin/mysqldump wp db export

This ensures wp db export always uses the correct binary on setups like yours.

Happy to improve the PR further if maintainers need anything!

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
How do I?
Labels
None yet
2 participants