Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Databases and Redis

mysqldump is not recognised or says command not found

Errormysqldump: command not found

Short answer

The shell only runs programs from folders listed in PATH, and the MySQL bin folder, where mysqldump lives, is not in it. Add that folder to PATH, then open a new terminal. On Windows use the Environment Variables dialog. On Unix put an export line in your shell startup file.

  • Applies to MySQL 8.4 on Windows 11, macOS package install, Linux bash and zsh
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Run the program by its full path. If that works, the tool is installed and only PATH is wrong. Use the folder where your MySQL is installed.

    # macOS or Linux
    /usr/local/mysql/bin/mysqldump --version
    # Windows
    "C:\Program Files\MySQL\MySQL Server 8.4\bin\mysqldump" --version
  2. 2Match what you see, then jump to its fix

    1. 1The Windows command prompt does not find mysqldump, while the full path worksThe MySQL bin folder is not in PATH on WindowsFix
    2. 2mysqldump: command not found, while the full path worksThe MySQL bin folder is not in PATH on macOS or LinuxFix

What does the error look like?

  • mysqldump: command not found

Cause 1 of 2

The MySQL bin folder is not in PATH on Windows

1Check

Show the PATH of the current console and look for the MySQL bin folder. A console that was already open before you edited PATH does not see the change.

echo %PATH%

2Fix

Open the Environment Variables dialog, edit Path under System variables, and add the full bin folder after a semicolon, for example C:\Program Files\MySQL\MySQL Server 8.4\bin. Click OK in each dialog. The manual warns against deleting or changing the rest of the Path value, and against doing this when several MySQL servers run on the machine.

C:\Program Files\MySQL\MySQL Server 8.4\bin

3Verify

Open a new command prompt and ask for the version.

mysqldump --version

Confirmed by dev.mysql.com

Did this fix it?

Cause 2 of 2

The MySQL bin folder is not in PATH on macOS or Linux

1Check

The macOS package installer puts MySQL in a versioned folder under /usr/local with a symlink at /usr/local/mysql, so the programs sit in /usr/local/mysql/bin. Check that it is on PATH.

ls /usr/local/mysql/bin/mysqldump
echo $PATH

2Fix

Add the bin folder to PATH and export it. For a bash setup the manual puts the line in .bashrc, or .bash_profile for login shells. The same line works in .zshrc for zsh.

export PATH=${PATH}:/usr/local/mysql/bin

3Verify

Log in again or open a new terminal, then run the command.

mysqldump --version

Confirmed by dev.mysql.com

Did this fix it?

How do I stop it coming back?

  • Add the bin folder to PATH as soon as MySQL is installed, and not for a machine that runs several MySQL servers.
  • In scripts, call mysqldump by its full path so they do not depend on PATH.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.