I am trying to reset the root password for mySQL Workbench since I forgot it. I was reviewing some online tutorials of how to do this, and they all speak of a "bin" folder. I went to the program folder, and didn't see a bin folder. How do I do this?
Log on to your system as Administrator. Stop the MySQL server if it is running. For a server that is running as a Windows service, go to the Services manager: From the Start menu, select Control Panel, then Administrative Tools, then Services. Find the MySQL service in the list and stop it.
spsv mysql*
kill -f -Pro mysqld -ErrorA Ignore
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;"
$defaultsFile = (gci -r -Path "C:\ProgramData\MySQL" -include my.ini).FullName
cd "C:\Program Files\MySQL\MySQL Server*\bin"
& .\mysqld.exe --defaults-file="$defaultsFile" --init-file="C:\\temp.txt"
ps mysqld | kill -f
sasv "MySql*"
& .\mysql -u root -p4321
\q
C:\
, then add reset password commands; ri
removes any existing temp.txt file.(gwmi win32_service | ?{$_.Name -like 'mysql*'} | select -First 1).PathName
.*
in the path means that we don't have to know our version number.&
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.bin
. After the test, you should see mysql>
. Use \q
to quit.http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With