How to reset or recover admin account password for MySql? - Server Fault most recent 30 from serverfault.com 2010-03-22T04:27:44Z http://serverfault.com/feeds/question/4309 http://www.creativecommons.org/licenses/by-nc/2.5/rdf http://serverfault.com/questions/4309/how-to-reset-or-recover-admin-account-password-for-mysql 2 How to reset or recover admin account password for MySql? slolife http://serverfault.com/users/1144 2009-05-04T20:45:46Z 2009-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#4312 11 Answer by David Schmitt for How to reset or recover admin account password for MySql? David Schmitt http://serverfault.com/users/326 2009-05-04T20:50:05Z 2009-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#4373 2 Answer by Brent for How to reset or recover admin account password for MySql? Brent http://serverfault.com/users/1466 2009-05-04T22:49:00Z 2009-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('&lt;new password&gt;') 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>