Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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) http://www.ubuntugeek.com/reset-the-root-password-on-mysql.html (2) http://www.howtoforge.com/reset-forgotten-mysql-root-password

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

3 Answers 3

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'; FLUSH PRIVILEGES;

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

 
discard

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.