Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the past there has been sudo /etc/init.d/mysql reset-password, (1) is manually restarting and setting the password with an sql command again required? (2)

(1) (2)

share|improve this question
second link look like the way to go – bodhi.zazen Dec 23 '11 at 5:25

There's also an administrative user equivalent to root: debian-sys-maint. You can use this account to reset root's password. You can find its password in /etc/mysql/debian.cnf

share|improve this answer

You could create a sql file say /root/mysql.reset.sql with the content:

UPDATE mysql.user SET Password=PASSWORD('yourpassword') WHERE User='root';

And just call:

mysqld_safe --init-file=/root/mysql.reset.sql

Will be very helpful if you are in a habit of forgetting passwords often.

share|improve this answer
sudo dpkg-reconfigure mysql-server-5.5

you can use tab complete after mysql-server- if you're using a different version of mysql.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.