Wednesday, July 14, 2010

Reset mysql root password - in LAMP / XAMPP

Once I forgot the mysql root password of my laptop computer in which I have Fedora 10 and also XAMPP running in it.

When I searched on Web there are soooo many solutions and none of them worked for me. However I could get un understanding about the issue....

With that I worked out in following way to get rid of the issue :

1. Stop mysqld
2. start /opt/lampp/sbin/mysqld --skip-grant-priviledges --user=nobody
3. open new terminal and type : mysql -u root
4. excute following commands in order :
shell> mysql
mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> exit

Now its done.

You may think that you can do use phpmyadmin after the step-2 to reset the root password. But it was not working for me though I have a phpmyadmin. So I worked our in mysql prompt.

After this everything were working wellll...

but I was not sure with one thing that I could not stop / restart mysql service as usual...
SO what I did is, I restarted the machine... SO simple ha!... but this is not possible in production servers....

Anyone of you know the solution for this?

Enjoy!....

5 comments:

MeanderingCode said...

When i try your technique with lampp 1.7.3a for Linux, i get the following error:

101003 19:42:51 [ERROR] ./sbin/mysqld: unknown option '--skip-grant-priviledges'


Both when i use a 'd', as in your post, and when i don't. What version are you running?

Thanks for putting this out there!

MeanderingCode said...

Okay, two things made it work:

Step 2: I replaced "--skip-grant-privileges" with "--skip-grant-tables"

Step 3: I had to specify the socket file path: Shell> mysql -S /opt/lampp/var/mysql/mysql.sock

Thanks again!

lala said...

Thanks for your post and welcome to check: here
.

lam said...

Thanks for your sharing!
I am operateing Wedding Dress Shops and Christian Louboutin Shoes, you may find you favorite there if you have a look. I believe everyone have a lovely babe to dress up, just like my wife. There is my shoes:
Christian Louboutin Shoes
Christian Louboutin Pumps
Wedding Dress Shops
Sorry for the bother, God bless you.

lily said...

hello!This was a really outstanding post!I come from itlay, I was luck to discover your website in wordpress Louboutin Shoes Also I get much in your Topics really thank your very much i will come again