2 Replies - 349 Views - Last Post: 20 April 2017 - 07:06 AM

#1 karengsh  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 129
  • Joined: 18-May 09

mysqld is not recognised as an internal or external command, operable

Posted 17 April 2017 - 08:37 PM

Hi expert,

I lost my password and need to reset it.

Tried using powerShell as well as cmd to do it but then I got the above message.

The steps that I tried to follow are as follows :

reference : https://dev.mysql.co...ns-windows.html

C:\> cd "C:\Program Files\MySQL\MySQL Server 5.7\bin"
C:\> mysqld --init-file=C:\\mysql-init.txt


1. Stop the MySQL service and process.
spsv mysql*
kill -f -Pro mysqld -ErrorA Ignore
2. Create a temporary init file
ri C:\temp.txt
ni -t f C:\temp.txt 
ac C:\temp.txt "UPDATE mysql.user SET Password=PASSWORD('4321') WHERE User='root';"
ac C:\temp.txt "FLUSH PRIVILEGES;"
3. Get the location of the MySQL defaults-file.
$defaultsFile = (gci -r -Path "C:\ProgramData\MySQL" -include my.ini).FullName
4. Change dir to MySQL bin.
cd "C:\Program Files\MySQL\MySQL Server*\bin"
5. Run mysqld with the password reset.
& .\mysqld.exe --defaults-file="$defaultsFile" --init-file="C:\\temp.txt"
6. Kill and Restart MySQLD (in a new PowerShell prompt).
ps mysqld | kill –f sasv "MySql*"
7. Return to the initial prompt and test
& .\mysql -u root -p4321 \q
Notes
1.	We cannot do anything until we stop MySql completely.
2.	Create this in C:\, then add reset password commands; ri removes any existing temp.txt file.
3.	You can retrieve this path through the Service Control Manager or use (gwmi win32_service | ?{$_.Name -like 'mysql*'} | select -First 1).PathName.
4.	The * in the path means that we don't have to know our version number.
5.	The & makes PowerShell run the exe like the command line does. Once you run this, PowerShell will appear to hang - that's because it's running the mysqld process.
6.	We need to kill in another process, because the existing console is busy.
7.	Return to the initial console, because it's already at bin. After the test, you should see mysql>. Use \q to quit.
See Also
http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html





Can someone tell me where I have gone wrong.

Tks.

This post has been edited by karengsh: 17 April 2017 - 08:39 PM


Is This A Good Question/Topic? 0
  • +

Replies To: mysqld is not recognised as an internal or external command, operable

#2 Atli  Icon User is offline

  • Enhance Your Calm
  • member icon

Reputation: 4238
  • View blog
  • Posts: 7,216
  • Joined: 08-June 10

Re: mysqld is not recognised as an internal or external command, operable

Posted 18 April 2017 - 02:00 AM

Are you sure the cd command worked?
What directory do you end up in before executing the mysqld process?

The error suggests you are either in the wrong directory, or that your MySQL installation is missing this essential file.
Try doing a dir command before executing it, see if you can find the mysqld.exe file in there.
Was This Post Helpful? 0
  • +
  • -

#3 karengsh  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 129
  • Joined: 18-May 09

Re: mysqld is not recognised as an internal or external command, operable

Posted 20 April 2017 - 07:06 AM

Hi Atli,

I found the solution after working on it for almost 4 days. Nearly gave up hope.

Enabled the hidden folder in your computer ProgramData, look for MySQL my.ini and add in below line inside :

skip-grant-tables

In this case, you will be able to access the database again.

Do note, this may not work if your goal is to re-set to a new password.

For me, I just want to gain access to my old database so no problem to use this method.

This post has been edited by karengsh: 20 April 2017 - 07:07 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1