How to reset or recover admin account password for MySql? - Server Fault most recent 30 from serverfault.com2010-03-22T04:27:44Zhttp://serverfault.com/feeds/question/4309http://www.creativecommons.org/licenses/by-nc/2.5/rdfhttp://serverfault.com/questions/4309/how-to-reset-or-recover-admin-account-password-for-mysql2How to reset or recover admin account password for MySql?slolifehttp://serverfault.com/users/11442009-05-04T20:45:46Z2009-05-04T22:49:00Z
<p>I have a MySql database that I "inherited" and I was not given the admin credentials. I do however have access to the box that it runs on. Is there a way to either recover the admin credentials or create new ones?</p>
http://serverfault.com/questions/4309/how-to-reset-or-recover-admin-account-password-for-mysql/4312#431211Answer by David Schmitt for How to reset or recover admin account password for MySql?David Schmitthttp://serverfault.com/users/3262009-05-04T20:50:05Z2009-05-04T20:50:05Z<p>Read and execute <a href="http://dev.mysql.com/doc/refman/5.1/en/resetting-permissions.html" rel="nofollow">the chapter about resetting the root password</a> in the MySQL Reference Manual.</p>
http://serverfault.com/questions/4309/how-to-reset-or-recover-admin-account-password-for-mysql/4373#43732Answer by Brent for How to reset or recover admin account password for MySql?Brent http://serverfault.com/users/14662009-05-04T22:49:00Z2009-05-04T22:49:00Z<p>If this is a Debian/Ubuntu box, there is a special root-equivalent account called <strong>debian-sys-maint</strong>. You can read the password in <strong>/etc/mysql/debian.cnf</strong></p>
<p>Using that password you can log into mysql as debian-sys-maint using:</p>
<pre><code>mysql -udebian-sys-maint -p
</code></pre>
<p>Once you are logged in, do the following:</p>
<pre><code>use mysql;
update user set password=password('<new password>') where user='root';
flush privileges;
quit;
</code></pre>
<p>root should now be accessible using your new password:</p>
<pre><code>mysql -uroot -p
</code></pre>