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 (https://blog.sqlauthority.com)
I thing this is better option
that suppose that someone knows where mysql is.. here is trying to help people who do not know where is mysql on their machine…
Hi Pinal, I think we can also set the full bin path in PATH system variables. So that everytime we open the command prompt it will be set and mysqld will be available.
Many thanks Pinal,
I can’t live without you.
you are for me dable
This is really awesome !! You have done a pukka job !! May God Bless You !!
Thank you so so much .Its been 2 hour i have this headache to find the solution..
A better way (on Windows): as Administrator user
Control Panel > Administrative Tools > Services (or just execute services.msc): select the service (MySQL), right click, select Properties, General tab: see “Path to executable” (“C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld” …)
Thanks .. I like you name :)
Access denied message is coming.
When I did as you instructed it only shows the first two lines, without the the Directory of C. Why?
Thanks a lot , it worked for me too.
thank you, it worked