How To Reset the MySQL Password : Ubuntu 7.10

By | 2008/01/08

I found myself toying with one of my test servers the other nite and realized that I didn’t know what the root password was for my MySQL database.  After a quick bit of Google searching I found a very easy solution.  Granted this may be limited to recent releases of Ubuntu (tested on Ubuntu 7.10), but other solutions did not work for me.

Resetting the Password

To reset the MySQL root password on Ubuntu we can simply reconfigure the installed package, which prompts for the root user password setting at installation.

sudo dpkg-reconfigure mysql-server-5.0

This should display a dialog box asking for a new root user password.  Enter a new password and it’s reset.  Can’t be much simpler than that.

14 thoughts on “How To Reset the MySQL Password : Ubuntu 7.10

  1. joelmedia

    Looks like the ‘reset-password’ function that a lot of other sites mention for this problem has been removed from the init.d script in ubuntu 7.10.

    Thanks, this is just what I needed. I can stop cutting myself now. 🙂

  2. gnuskool

    This works great, thumbs up geezer. I read heaps of different methods etc infinitum, yours worked straight away


    Worked perfectly and faster than most methods which didn't work very well.

  4. Desktop Backgrounds

    Justin’s instructions were very easy, just one line in Terminal!

    # mysqladmin password NEWPASSWORD

    As root

    Works good! Thanks.

  5. Tom

    thanks a lot of for your greatful help! It´s was very helpfull on my Ubuntu-System.


  6. tormaser

    hey i got an error after type
    # mysqladmin password NEWPASSWORD

    mysqladmin: connect to server at ‘localhost’ failed
    error: ‘Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)’
    Check that mysqld is running and that the socket: ‘/var/run/mysqld/mysqld.sock’ exists!

    any ideas??


  7. Bob

    Thanks that worked sweet .. new it was a command something like that but just couldn’t find it ..

Comments are closed.