Recover Reset MySql Root Password

It has been a few weeks since I last touched the server and I couldn’t remember the root password for MySql. I’m lucky enough to find the following website, which tells me how to get around it.

http://blog.taragana.com/index.php/archive/how-to-recover-mysql-root-password/

The whole idea is very clever, all we need to do is to stop MySql process and start it without the permission mode. Then we can choose to reset the password and restart the MySql again.

$ sudo /etc/init.d/mysql stop

$ sudo mysqld_safe –skip-grant-tables &

$ mysql -u root

Now that we are in …

> use mysql

> UPDATE user SET password = PASSWORD(‘NEW-PASSWORD’) WHERE user = ‘root’;

> flush privileges;

> quit

Then re can restart the MySql and try to login with the new password.

$ sudo /etc/init.d/mysql restart

# mysql -u root -p

Advertisements

Link to go back to the root of webapp in jsp

I have been thinking about the code to simply go back to the root of the webapp.

For example: URL/myapp

The solution is really easy:

<a href=”.”>Return To Home Page</a>