View Full Version : [ubuntu] Forgot the mysql password.....

December 10th, 2008, 12:28 PM
Hi, Some days ago I started trying to make a server on my computer. For this goal to happen I install LAMP. Than at first I had problems putting files in my /var/www folder which after a long fight I finally made it to work. But, now here is the other problem. I am not exactly sure but I remember entering a password during the Lamp instalation which I thought is my mysql password but now when when I am trying to install script that I had used before it does not want to connect to mysql. So bacicly I don't have access to my mysql server. Can you tell me a way to change the password of MSQL without knowing the current password? If there is not one can you tell me how to do full uninstall of LAMP so I can start from clean instalation again. Thank you in advice!

December 10th, 2008, 12:50 PM
try that

reset root password
sudo /etc/init.d/mysql stop
sudo /usr/bin/mysqld_safe --skip-grant-tables &
mysql -u root mysql
UPDATE user SET password=PASSWORD('your_password') WHERE user = 'root';
sudo pkill mysql_safe (or kill -9 pid)
sudo /etc/init.d/mysql restart

December 10th, 2008, 01:43 PM

December 10th, 2008, 03:51 PM
Easier than that. I think this will work on hardy or intrepid.

sudo dpkg-reconfigure mysql-server-5.0

If you really want to completely remove it, though

sudo dpkg -P mysql-server mysql-server-5.0

March 7th, 2009, 03:56 PM
Yes it worked for me .....

Its really useful ....

Use the command

sudo dpkg-reconfigure mysql-server-5.0