Mysql is not recognized as an internal or external command, operable program or batch file

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Pick a username Email AddressPassword

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question

i am trying to connect the mysql server,it is refused connection


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Find by Category

I assume that you already have installed MySQL on your Windows operating system and you are trying to access it through command prompt or PowerShell and you are getting this message MySQL is not recognized as an internal or external command, operable program or batch file. 

I completely understand why you are getting this message. Basically, we need to add MySQL to the systems variable path.

To add MySQL to the system’s variable path, we need to locate the Bin folder in MySQL installation directory and then add it to the system’s variable path.

 Alright let’s do it

Watch me fix – MySQL is not recognized as an internal or external command

Mysql is not recognized as an internal or external command, operable program or batch file

By continuing to browse the site you are agreeing to our use of cookies.

I did set the MySQL path, but still, I'm getting the same error. Please let me know whether I followed it correctly or not.

MySQL location is: C:\Program Files\MySQL\MySQL Server 5.0\bin

In Windows, in the system variables, I had set the path as:

  • variable name: MYSQL_HOME
  • variable value: C:\Program Files\MySQL\MySQL Server 5.0\bin

For PATH setting:

  • variable name: PATH
  • variable value: .;%JAVA_HOME%\bin;%MYSQL_HOME%\bin...

If it is not correct, please let me know the correct path and its settings.

Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Posted by Christopher Sumpter

I am using Start Command Prompt with Ruby on Windows 8.1. When I type mysql -uroot, I get the message 'mysql' is not recognized as an internal or external command, operable program or batch file.

3 Answers

Tommy Bregar April 25, 2015 1:57am

This line is possibly due to a permissions issue:

5616 [ERROR] InnoDB: The system tablespace must be writable!

Try starting your command prompt as Administrator (Start-> Run-> cmd RIGHT CLICK-> Run as Administrator...)

As for this line:

c:\Users\sumpt_000\biller>mysql -uroot 'mysql' is not recognized as an internal or external command, operable program or batch file.

Be sure that your mysql\bin folder is part of your $PATH variable:

  1. Go to Control Panel -> System -> Advanced
  2. Click Environment Variables
  3. Under System Variables find PATH and click on it.
  4. In the Edit windows, find the end of the string of paths (each path needs to be separated by a semi-colon ";" so you may need to add that to the end) add the path to your mysql\bin folder to the end paths.
  5. Go back to Desktop
  6. Close any command prompts you may have open Got to do this so the new $PATH variable will load.
  7. Re-open command prompt. Try running mysql -uroot and if the path was set correctly, mysql will now run.

Let us know if this takes care of it!

Iain Simmons July 23, 2015 9:16pm

I realise this question has been answered, but something else I just discovered with my own Windows installation of MySQL is that some of the folders that are created and added to the PATH variable upon installing MySQL contain an ampersand (&) character, which breaks when passed as a parameter.

You might find that the C:\Program Files\MySQL\MySQL Server 5.0\bin directory comes after the one with the ampersand in the PATH variable.

The solution in this case is to escape the ampersand with a caret (^), so it is ^&

e.g.

C:\Program Files\MySQL\MySQL Fabric 1.5.4 ^& MySQL Utilities 1.5.4 1.5\;C:\Program Files\MySQL\MySQL Fabric 1.5.4 ^& MySQL Utilities 1.5.4 1.5\Doctrine extensions for PHP\;C:\Program Files\MySQL\MySQL Server 5.6\bin

Graeme Campbell December 12, 2015 10:10pm

Brilliant, Thank you Iain, that solved my problem :D.

How do you install MySQL on Windows using CMD?

To install MySQL Shell binaries:.
Unzip the content of the Zip file to the MySQL products directory, for example C:\Program Files\MySQL\ ..
To be able to start MySQL Shell from a command prompt add the bin directory C:\Program Files\MySQL\mysql-shell-1.0. 8-rc-windows-x86-64bit\bin to the PATH system variable..

Is not recognized as an internal or external command operable program or batch file Windows?

You can resolve this issue in three ways: First, use the full path of the executable file to launch the program. Second, add the program path to Windows environment variables. Finally, move the files to the System32 folder.

How do I install MySQL on Windows 10?

How to Download MySQL's Free Community Edition.
Go to the MySQL website and select Downloads..
Select MySQL Community (GPL) Downloads. ... .
On the following page, select MySQL Community Server..
Scroll down to the bottom of the page and select the Go to Download Page next to Windows (x86, 32 & 64-bit), MySQL Installer MSI..

How do I enable MySQL on Windows?

Windows – Start and Stop Server.
Open 'Run' Window by using Win key + R..
Type 'services.msc'.
Now search for MySQL service based on the version that is installed..
Click on 'stop', 'start' or 'restart' the service option..