Home > DIY > Resetting mysql root password in Ubuntu Dapper

Resetting mysql root password in Ubuntu Dapper

First you kill the running mysql server gracefully. The process id is grabbed from /var/run/mysqld/ and inserted into the kill statement. Note there are ticks around the process id, not single quotes.

Then the server is restarted with the permissions turned off, and the root user password can be changed.
Type this in terminal:

sudo su
kill `cat /var/run/mysqld/mysqld.pid`
mysqld --skip-grant-tables &
mysql -u root
UPDATE mysql.user SET Password=PASSWORD ('newpassword') WHERE User = 'root';
exit
kill `cat /var/run/mysqld/mysqld.pid`
mysqld &
mysql -u root -p

Enter your new password and you should be in.

Advertisements
Categories: DIY
  1. ereader
    April 20, 2007 at 3:54 am

    mysqld –skip-grant-tables &

    should read

    mysqld -–skip-grant-tables &

  2. April 20, 2007 at 8:42 am

    That is what it said. I had it entered as code in html and it rendered funny. I changed it to pre and it looks right now.

  3. jwcutler
    October 24, 2008 at 9:19 am

    Thanks for the tip.

  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: