{"id":999,"date":"2012-08-18T05:02:06","date_gmt":"2012-08-18T05:02:06","guid":{"rendered":"http:\/\/www.top-password.com\/blog\/?p=999"},"modified":"2012-08-18T05:02:06","modified_gmt":"2012-08-18T05:02:06","slug":"how-to-reset-mysql-root-password","status":"publish","type":"post","link":"https:\/\/www.top-password.com\/blog\/how-to-reset-mysql-root-password\/","title":{"rendered":"How to Reset MySQL Root Password"},"content":{"rendered":"<p>Forgot your MySQL root user password? Don&#8217;t worry. We are here for rescue.<\/p>\n<p>When you tried to login to root without entering a password, you may get &#8216;Access Denied&#8217; message, as MySQL is expecting a password. This article explains how to reset MySQL root password when you don&#8217;t remember your old one.<\/p>\n<p><strong>How to Reset MySQL Root Password:<\/strong><\/p>\n<p><strong>Step 1<\/strong>: Stop the MySQL service by going to Control Panel, Administrative Tools and Services. Right-click on the service and choose <strong>Stop<\/strong>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1000\" title=\"stop-mysql\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2012\/08\/stop-mysql.png\" alt=\"\" width=\"548\" height=\"131\" srcset=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2012\/08\/stop-mysql.png 548w, https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2012\/08\/stop-mysql-300x71.png 300w\" sizes=\"auto, (max-width: 548px) 100vw, 548px\" \/><\/p>\n<p><strong>Step 2<\/strong>: Create a new text file and copy and paste the following lines into it:<\/p>\n<pre>UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';\r\nFLUSH PRIVILEGES;<\/pre>\n<p>Make sure to change the password &#8220;MyNewPass&#8221; to whatever password you want to replace the current one with. Now save the file and give it a name like <strong>C:\\mysql-init.txt<\/strong> or whatever you like.<\/p>\n<p><strong>Step 3<\/strong>: Now go to the command prompt and type in the following command:<\/p>\n<pre>C:\\&gt; <strong><code>C:\\mysql\\bin\\mysqld-nt --init-file=C:\\mysql-init.txt<\/code><\/strong><\/pre>\n<p>In my case, I had to change the path to something different than C:\\mysql\\bin. If you installed MySQL using the installation wizard, which I did, you have to use a different command:<\/p>\n<pre>C:\\&gt; <strong><code>\"C:\\Program Files\\MySQL\\MySQL Server 5.0\\bin\\mysqld-nt.exe\"<\/code><\/strong>\r\n         <strong><code>--defaults-file=\"C:\\Program Files\\MySQL\\MySQL Server 5.0\\my.ini\"<\/code><\/strong>\r\n         <strong><code>--init-file=C:\\mysql-init.txt<\/code><\/strong><\/pre>\n<p>So what is the path for your defaults-file? You can get the exact value by going to the Services dialog again and right-clicking on MySQL and choosing <strong>Properties<\/strong>. The box that says &#8220;<strong>Path to executable<\/strong>&#8221; has the value for defaults-file.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1001\" title=\"mysql-service\" src=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2012\/08\/mysql-service.png\" alt=\"\" width=\"405\" height=\"332\" srcset=\"https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2012\/08\/mysql-service.png 405w, https:\/\/www.top-password.com\/blog\/wp-content\/uploads\/2012\/08\/mysql-service-300x245.png 300w\" sizes=\"auto, (max-width: 405px) 100vw, 405px\" \/><\/p>\n<p>At this step, I ran into an error. Every time I would try to execute the command, I would end up getting an error message and the password would not be reset.<\/p>\n<p><em>InnoDB: Operating system error number 32 in a file operation.<\/em><br \/>\n<em>InnoDB: The error means that another program is using InnoDB&#8217;s files.<\/em><br \/>\n<em>InnoDB: This might be a backup or antivirus software or another instance<\/em><br \/>\n<em>InnoDB: of MySQL. Please close it to get rid of this error.<\/em><\/p>\n<p>In my case, I have to go to the Task Manager and click on the Processes tab. Here I found that I already had several instances of MySQL running! I don&#8217;t know why or how they were started, but even with the service stopped, there were processes running.<\/p>\n<p>I killed off all the processes and ran the command again, which worked perfectly.<\/p>\n<p><strong>Step 4<\/strong>: Go back to the Services window and restart the MySQL service. You should now be able to log into the MySQL database! Enjoy!<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Forgot your MySQL root user password? Don&#8217;t worry. We are here for rescue. When you tried to login to root without entering a password, you may get &#8216;Access Denied&#8217; message, as MySQL is expecting a password. This article explains how to reset MySQL root password when you don&#8217;t remember your old one. How to Reset [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,10],"tags":[416,417,415],"class_list":["post-999","post","type-post","status-publish","format-standard","hentry","category-others","category-tips-tricks","tag-forgot-mysql-password","tag-reset-mysql-password","tag-reset-mysql-root-password"],"_links":{"self":[{"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/posts\/999","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/comments?post=999"}],"version-history":[{"count":2,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/posts\/999\/revisions"}],"predecessor-version":[{"id":1003,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/posts\/999\/revisions\/1003"}],"wp:attachment":[{"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/media?parent=999"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/categories?post=999"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.top-password.com\/blog\/wp-json\/wp\/v2\/tags?post=999"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}