MySQL is a free and open-source relational database management system used to manage servers and databases. It is an amazing software to help programmers manage small as well as large applications. When you are working with MySQL, you may experience the error “MySQL command not found”.
If you think you are stuck, then don’t as Tutopal is here to assist you in the best possible way. In this post, you find useful information and solution to resolve the error.
How the error appears
To start up the interface of MySQL, you use a command, the system looks out for its directories in order to try to execute. When your system does not find the program’s location that you wish to run, then you get the error ‘command not found’. The prominent causes of the error warning are:
No PATH environment variable is set
When no path variable is set, you get the error as it is the most common cause of the error. Setting up the correct path needs to be set. It helps list each and every directory that the system looks for when searching to find the command you entered in your terminal. In case the command you are trying to run is not available in any folder in the PATH defined, then you get the error warning.
Corrupt installation of MySQL
When you are installing MySQL, sometimes the process gets corrupted. To cater it, installing it all over again is required. You can easily find resources if you need help installing MySQL for Ubuntu 18.04, Windows, or CentOS7.
Steps To Resolve the Error “MySQL command not found” In Windows
Using a command in the cmd prompt in Windows to launch MYSQL can either open the software or if not executed by the system, get the error warning. This is the command to launch:
mysql -u root -p
To tackle the error, you need to follow the below steps:
- First, click the Start Menu in Windows and choose This PC.
- Tap the Properties you probably see in the end.
- Once you open it, click Advanced System Settings.
- Tap the button that says Environment Variable.
- There you find the Path system variable, single-click it, and then tap Edit.
- To add the correct path for the MySQL folder, click NEW.
- Recover the complete path of MySQL installation. Perhaps, you have it in your C partition inside the folder Program File.
- Within this folder, look for the ‘bin’ folder. Once you find it, copy the path.
- Paste the complete path you copied to the window of Edit Environment Variable and tap OK to save and apply the changes, and also exit the screen.
- Once you are done, enter the cmd again:
mysql -u root -p
You can type the password in case you predefined it.
And that’s how you can get rid of the error “MySQL command not found”. If you are using Windows, you can simply implement it or refer to it whenever you encounter this error. I hope you enjoyed it.
I wish you a happy error-solving!