mysqldump is not recognised or says command not found
mysqldump: command not foundShort 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.
Fix it fast
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" --version2Match what you see, then jump to its fix
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\bin3Verify
Open a new command prompt and ask for the version.
mysqldump --versionConfirmed by dev.mysql.com
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 $PATH2Fix
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/bin3Verify
Log in again or open a new terminal, then run the command.
mysqldump --versionConfirmed by dev.mysql.com
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:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- ShopGoAn e-commerce aggregator with a Python scraping engine behind its catalog, past 10K Google Play downloads.
Related fixes
Databases
Installing the Airflow MySQL provider fails on pkg-config or mysqlclient
Building the mysqlclient wheel fails during the install
The Airflow MySQL provider depends on mysqlclient, which pip compiles against the MySQL C client library.
2 causes, each with a fixDatabases
Compiling a C or C++ program that includes mysql.h fails
undefined reference to `mysql_init'
The compiler only finds mysql.h when the MySQL client development files are installed and their folder is on the include path.
3 causes, each with a fixDatabases
An EC2 instance cannot reach its RDS database
Could not open connection to the host, on port <port>: Connect failed
RDS denies all access until a security group allows it.
3 causes, each with a fixDatabases
Locked out of a fresh MariaDB install as root on Mac or Linux
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
A fresh MariaDB root account is not a normal password account.
3 causes, each with a fixDatabases
An Aria table fails with 'Read page with wrong checksum' (error 1030, code 176)
ERROR 1030 (HY000): Got error 176 "Read page with wrong checksum" from storage engine Aria
Code 176 means MariaDB's Aria engine read a data or index page whose checksum does not match, so that table file is damaged.
3 causes, each with a fixDatabases
The client cannot open a TCP connection to MariaDB or MySQL (error 2003)
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1:3306' (111)
Error 2003 means the client tried a TCP connection to the host and port and nobody answered.
4 causes, each with a fix