<!DOCTYPE html> <html> <head> </head> <body> <p><strong>Commands</strong></p> <pre class="code-pre "><code>sudo /etc/init.d/mysql stop </code></pre> <p>Now start up MySQL in safe mode, so you'll skip the privileges table:</p> <pre class="code-pre "><code>sudo mysqld_safe –skip-grant-tables & </code></pre> <p>Login with root:</p> <pre class="code-pre "><code>mysql -uroot </code></pre> <p>And assign the DB that needs to be used:</p> <pre class="code-pre "><code>use mysql; </code></pre> <p>Now all you have to do is reset your root password of the MySQL user and restart the MySQL service:</p> <pre class="code-pre "><code>update user set password=PASSWORD("YOURPASSWORDHERE") where User='root'; </code></pre> <pre class="code-pre "><code>flush privileges; </code></pre> <p>quit and restart MySQL:</p> <pre class="code-pre "><code>quit </code></pre> <pre class="code-pre "><code>sudo /etc/init.d/mysql stop sudo /etc/init.d/mysql start </code></pre> <p>Now your root password should be working with the one you just set, check it with:</p> <pre class="code-pre "><code>mysql -u root -p</code></pre> </body> </html>
Subscribe
0 Comments
Oldest