{"id":128,"date":"2020-02-28T03:30:00","date_gmt":"2020-02-28T03:30:00","guid":{"rendered":"https:\/\/molecularsciences.org\/content\/?p=128"},"modified":"2024-02-08T08:57:44","modified_gmt":"2024-02-08T13:57:44","slug":"how-to-reset-mysql-root-password","status":"publish","type":"post","link":"https:\/\/molecularsciences.org\/content\/how-to-reset-mysql-root-password\/","title":{"rendered":"How to reset MySQL root password"},"content":{"rendered":"\n<p>To reset MySQL password, you need to have root access to the machine. After logging in as root, start by shutting down MySQL:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ \/sbin\/service mysqld stop<\/code><\/pre>\n\n\n\n<p>Verify that all mysql processes have been shut down.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ ps waux | grep 'mysql'<\/code><\/pre>\n\n\n\n<p>For all processes that are listed<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ kill -9 &lt;process-number><\/code><\/pre>\n\n\n\n<p>Find your mysqld_safe.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ locate mysqld_safe<\/code><\/pre>\n\n\n\n<p>My mysqld_safe is installed at \/usr\/bin\/mysqld_safe. Yours might be elsewhere. Start MySQL without the grant tables.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ \/usr\/bin\/mysqld_safe --skip-grant-tables<\/code><\/pre>\n\n\n\n<p>At this point, you would need to open a new terminal.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ locate mysql | grep 'bin\/mysql'$<\/code><\/pre>\n\n\n\n<p>My mysql binary is located ate \/usr\/bin\/mysql. Run mysql.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ \/usr\/bin\/mysql mysql<\/code><\/pre>\n\n\n\n<p>Update your root password<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql> UPDATE user SET password=password('new-password') WHERE host='localhost' and user = 'root';<\/code><\/pre>\n\n\n\n<p>Log out of MySQL.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql> exit<\/code><\/pre>\n\n\n\n<p>Restart MySQL.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ \/sbin\/service mysqld restart<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>To reset MySQL password, you need to have root access to the machine. After logging in as root, start by shutting down MySQL: Verify that all mysql processes have been shut down. For all processes that are listed Find your mysqld_safe. My mysqld_safe is installed at \/usr\/bin\/mysqld_safe. Yours might be elsewhere. Start MySQL without the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,204],"tags":[14,27],"class_list":["post-128","post","type-post","status-publish","format-standard","hentry","category-database","category-mysql","tag-database","tag-mysql"],"_links":{"self":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/128","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/comments?post=128"}],"version-history":[{"count":1,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/128\/revisions"}],"predecessor-version":[{"id":129,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/128\/revisions\/129"}],"wp:attachment":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/media?parent=128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/categories?post=128"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/tags?post=128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}