<p>I have long since forgotten the password for the root user on one of my boxes. Is there a way I can change it without having to log in to the instance, or will I have to reinstall?</p>

[{'answer_id': 53483, 'author': 'Nick Stinemates', 'author_id': 4960, 'author_profile': 'https://Stackoverflow.com/users/4960', 'pm_score': 2, 'selected': False, 'text': '<p>A quick Google resulted in this answer. In the root shell type:</p>\n\n<pre><code>mysqladmin -u root password &lt;password&gt;\n</code></pre>\n'}, {'answer_id': 53567, 'author': 'BlaM', 'author_id': 999, 'author_profile': 'https://Stackoverflow.com/users/999', 'pm_score': 3, 'selected': True, 'text': '<p><strong>Step 1</strong></p>\n\n<p>Stop database:</p>\n\n<pre><code>shell&gt; /etc/init.d/mysql stop\n</code></pre>\n\n<p><strong>Step 2</strong></p>\n\n<p>Restart database</p>\n\n<ul>\n<li>without password autentification</li>\n<li>without connection to the network</li>\n</ul>\n\n<p>Access to database is only possible through it\'s sock file \'/var/lib/mysql/mysql.sock\'.</p>\n\n<pre><code>shell&gt; mysqld --user=mysql --pid-file=/var/lib/mysql/mysqld.pid \\\n       --socket=/var/lib/mysql/mysql.sock --datadir=/var/lib/mysql \\\n       --skip-grant-tables --skip-networking  &amp;\n</code></pre>\n\n<p><strong>Step 3</strong></p>\n\n<p>Connect to the database and change password:</p>\n\n<pre><code>shell&gt; mysql --database mysql --socket=/var/lib/mysql/mysql.sock\n</code></pre>\n\n<p>If you want to, show all users:</p>\n\n<pre><code>mysql&gt; select User, password from user;\n</code></pre>\n\n<p>Set new password:</p>\n\n<pre><code>mysql&gt; update user set password=password(\'NEW PASS\') WHERE User=\'USERNAME\';\n</code></pre>\n\n<p>Leave database connection:</p>\n\n<pre><code>mysql&gt; exit\n</code></pre>\n\n<p><strong>Step 4</strong></p>\n\n<p>Restart database server "normally".</p>\n\n<pre><code>shell&gt; kill `cat /var/lib/mysql/mysqld.pid`\nshell&gt; /etc/init.d/mysql start\n</code></pre>\n'}, {'answer_id': 22678039, 'author': 'user12345', 'author_id': 1048805, 'author_profile': 'https://Stackoverflow.com/users/1048805', 'pm_score': 0, 'selected': False, 'text': '<p>If you are running an Ubuntu server (possibly also Debian?) you can easily reset. </p>\n\n<p>If you are on 12.04:</p>\n\n<pre><code>sudo dpkg-reconfigure mysql-server-5.5\n</code></pre>\n\n<p>If you are on 10.04:</p>\n\n<pre><code>sudo dpkg-reconfigure mysql-server-5.1\n</code></pre>\n\n<p>If you are not sure which mysql-server version is installed you can try: </p>\n\n<pre><code>dpkg --get-selections | grep mysql-server\n</code></pre>\n\n<p>See for more info:</p>\n\n<p><a href="https://help.ubuntu.com/12.04/serverguide/mysql.html" rel="nofollow">https://help.ubuntu.com/12.04/serverguide/mysql.html</a>\n<a href="https://help.ubuntu.com/10.04/serverguide/mysql.html" rel="nofollow">https://help.ubuntu.com/10.04/serverguide/mysql.html</a></p>\n'}]
['https://Stackoverflow.com/questions/53482', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4960/']