How to Resolve: MySQL Command Not Found
Robert Cooper
Robert Cooper Senior Engineer at Basedash
· January 31, 2025
Robert Cooper
Robert Cooper Senior Engineer at Basedash
· January 31, 2025
The ‘MySQL command not found’ error usually means the MySQL software is either not installed on your system or its installation path is not included in your system’s PATH environment variable. This guide covers how to resolve the issue.
When you try to run MySQL from the command line and receive the ‘MySQL command not found’ error, it’s because the system cannot locate the MySQL executable in the directories listed in the PATH environment variable. This error is common in new installations or when switching between multiple MySQL versions.
First, verify whether MySQL is installed. Run the following command in your terminal:
mysql --version
If MySQL is installed, this command returns the version. If not, you’ll need to install MySQL.
If MySQL is not installed, you can download it from the official MySQL website. Installation procedures vary based on your operating system.
sudo apt-get update
sudo apt-get install mysql-server
brew install mysql
Download the installer from the MySQL website and follow the installation wizard.
If MySQL is installed but not recognized, add its directory to the PATH environment variable.
Find the MySQL installation path:
which mysql
Add the path to your profile script (like .bashrc or .zshrc):
echo 'export PATH="/path/to/mysql/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Replace /path/to/mysql/bin with the actual path.
After installation or updating the PATH, run mysql --version again. If the setup is correct, the command should now return the MySQL version.
If the problem persists:
Basedash is built as an AI-native BI platform, so teams can go from ad hoc SQL to trusted answers and dashboards quickly, without the overhead of traditional BI setup.
Written by
Senior Engineer at Basedash
Robert Cooper is a senior engineer at Basedash who builds full-stack product systems across SQL data infrastructure, APIs, and frontend architecture. His work focuses on application performance, developer velocity, and reliable self-hosted workflows that make data operations easier for teams at scale.
Basedash lets you build charts, dashboards, and reports in seconds using all your data.