Reset mysql root password?

So I migrated hosts… but seemed to have forgotten my mysql root password.

I am running 10.04 and found this mysql link ~~[" target="_blank">]( … sions.html">]( but can't seem to find the .pid file.

Are there any linode library or other resources that can help me out?

3 Replies

You don't need to locate the pid file. Just type sudo /etc/init.d/mysql stop to stop MySQL. Skip sudo if you're root.


You don't need to locate the pid file. Just type sudo /etc/init.d/mysql stop to stop MySQL. Skip sudo if you're root.

Is this what the OP is really asking for? I think he's trying to reset the password to his MySQL server.

BTW, OP, no PID usually means the service isn't running.

The quicker method would probably be the "B. Resetting the Root Password: Generic Instructions" steps (IMO).

In a similar case, today I was unable to login into MySQL, into ISPConfig, and even into my Linode. The solution to reset the root passwords was the following.

First, the Linode (Debian 5.0):

__Linode Manager > Dashboard > Shutdown

Linode Manager > Settings & Utilities > Change a Filesystem's root Password

Linode Manager > Dashboard > Boot__

After that I could login again into my Linode via SSH (PuTTY) and SFTP (WinSCP).

Then, I tried many online suggestions to also reset the MySQL root password, with no success, always getting:

ERROR 1045 (28000): Access denied for user 'root'@'localhost'

MySQL's B.5.4.1. How to Reset the Root Password seemed pretty complex, so I used another simpler solution, and it worked:

/etc/init.d/mysql stop
mysqld_safe --skip-grant-tables &
mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD("newrootpassword") where User='root';
mysql> flush privileges;
mysql> quit
/etc/init.d/mysql stop
/etc/init.d/mysql start

Additionaly, I use the ISPConfig control panel, and this page was helpful for the third password I had to reset: How to reset the administrator password in ISPConfig 3. And then, to change the new password:

ISPConfig > Tools > Password and Language

Hope this helps others in similar situations.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct