<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.8.5">Jekyll</generator><link href="https://slayerz.libcat.my/feed.xml" rel="self" type="application/atom+xml" /><link href="https://slayerz.libcat.my/" rel="alternate" type="text/html" /><updated>2019-11-26T13:43:46+00:00</updated><id>https://slayerz.libcat.my/feed.xml</id><title type="html">SLAYERZ</title><subtitle>snippet・programming・tutorial</subtitle><author><name>Pikri Mohammad</name></author><entry><title type="html">Reset root password for mysql</title><link href="https://slayerz.libcat.my/reset-root-password-for-mysql/" rel="alternate" type="text/html" title="Reset root password for mysql" /><published>2019-11-22T00:00:00+00:00</published><updated>2019-11-22T00:00:00+00:00</updated><id>https://slayerz.libcat.my/reset-root-password-for-mysql</id><content type="html" xml:base="https://slayerz.libcat.my/reset-root-password-for-mysql/">&lt;p&gt;Sometimes I totally forgot the root password that I set for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mysql&lt;/code&gt;. So, I’m writing these steps for my own reference, and for others who faced the same problem.&lt;/p&gt;

&lt;h2 id=&quot;steps&quot;&gt;Steps&lt;/h2&gt;

&lt;p&gt;Firstly, &lt;strong&gt;stop&lt;/strong&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mysql&lt;/code&gt; service and then &lt;strong&gt;start&lt;/strong&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mysql&lt;/code&gt; service with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--skip-grant-tables&lt;/code&gt; option:&lt;/p&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;service mysql stop
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;mysqld &lt;span class=&quot;nt&quot;&gt;--skip-grant-tables&lt;/span&gt;
mysql &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; root mysql
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Update the root password with the new password:&lt;/p&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;UPDATE user SET password &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; PASSWORD&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'newpass'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
WHERE user &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'root'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
FLUSH PRIVILEGES&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Finally, restart &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mysql&lt;/code&gt; service normally:&lt;/p&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;service mysql restart
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now you should be able to login &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mysql&lt;/code&gt; as root with the new password.&lt;/p&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mysql &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; root &lt;span class=&quot;nt&quot;&gt;-p&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</content><author><name>Pikri Mohammad</name></author><summary type="html">Sometimes I totally forgot the root password that I set for mysql. So, I’m writing these steps for my own reference, and for others who faced the same problem.</summary></entry></feed>