How do you fix MySQL is not recognized as an internal or external command operable program or batch file?

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.

One of the most popular question I get after watching my MySQL courses on Pluralsight is that beginning users are not able to find where they have installed MySQL Server.

The error they receive is as follows when they type mysqld command on their default command line.

mysql‘ is not recognized as an internal or external command, operable program or batch file.

This error comes up if user try to execute mysqld command on default command prompt. The user should execute this command where mysql.exe file exists.  If you are using Windows Explorer you can easily search on your drive mysqld.exe and find the location of the file and execute the above command there. However, if you want to find out with command prompt the location of mysqld.exe file you can follow the direction here.

Step 1: Open a command prompt

Open command prompt from Start >> Run >> cmd >> enter

Step 2: Change directory

You need to change the default directory to root directory, hence type cd\ command on the prompt to change the default directory to c:\ . Here we are assuming that you have installed MySQL on your c: drive. If you have installed it on any other drive change the drive to that letter.

Step 3: Search Drive

Type the command dir mysqld.exe /s /p on the command prompt.

It will search your directories and will list the directory where mysqld.exe is located.

Step 4: Change Directory

Now once again change your command prompt file location to the folder where your mysqld.exe is located. In my case it is located here in folder C:\Program Files\MySQL\MySQL Server 5.6\bin hence I will run following command: cd C:\Program Files\MySQL\MySQL Server 5.6\bin .

Step 5: Execute mysqld.exe

Now you can once again mysqld.exe on your command prompt.

You can use this method to search pretty much any file with the help of command prompt.

Reference: Pinal Dave (//blog.sqlauthority.com)

Related Posts

How do you resolve is not recognized as an internal or external command operable program or batch file?

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 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..

Why MySQL command line is not opening?

Open Command prompt in admin and go to the location of Mysql bin folder and type - C:\ProgramFile\mysql\bin>mysql -u root -p <password> 2. Then the prompt asks for the password. This is the password or the root user which you had set during installation of mysql.

How do I install MySQL command line?

Installing MySQL Shell with the MySQL APT Repository.
Update package information for the MySQL APT repository: sudo apt-get update..
Update the MySQL APT repository configuration package with the following command: sudo apt-get install mysql-apt-config. ... .
Install MySQL Shell with this command: sudo apt-get install mysql-shell..

Toplist

Neuester Beitrag

Stichworte