I have installed mysql-server on my laptop running Debian back in awhile. For that reason, I forgot the root password. Just recently, I need to use MySQL server for one of my assignments. So, I was playing around in /etc/mysql/ directory hoping that I could get rid of the server and then reinstall it. The commands apt-get remove <strong>mysql-server</strong> didn’t seem to remove files/directories related to MySQL. Then, I decided to delete the /etc/mysql/ manually.

After I reinstalled mysql-server, a few config files ,contained in /etc/mysql direcotry, were never reinstalled. As always, I turned to Google for helps. With a few different combination of keywords, I found a solution to problem.

First, let’s completely remove mysql-server:

$ sudo apt-get remove <strong>--purge</strong> mysql-common<br /> $ sudo apt-get remove mysql-server

Then reinstall mysql-server again:

$ sudo apt-get install mysql-common mysql-server

This time, I carefully chose a root password which was easy enough to remember. And voilla, it worked!

$ mysql -u root -p<br /> Enter password:<br /> Welcome to the MySQL monitor. Commands end with ; or g.<br /> Your MySQL connection id is 12<br /> Server version: 5.0.45-Debian_1-log Debian etch distribution

Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

mysql>