Thursday 19 December 2019

How to reset the MySQL root password

The following steps describe the procedure to reset the mysql root password on Linux.
1) Stop the mysql server
/etc/init.d/mysql stop
2) Start the mysql server manually without permission tables which allows us to login as root user without password:
mysqld_safe --skip-grant-tables &
3) Login into mysql as root user without a password and switch to the "mysql" database:
mysql -u root mysql
Then execute this SQL query to set a new password for the mysql root user:
use mysql;
update user set Password=PASSWORD('mynewpassword') WHERE User='root';
(Replace "mynewpassword" with the new root password in the above command).
Then logout from the mysql prompt by typing:
exit
4) Now bring back the running mysql instance into the foreground by typing:
fg
and then press [ctrl] + c to kill the mysql process.
5) Start the mysql server again:
/etc/init.d/mysql start

1 comment:

  1. Water Hack Burns 2lb of Fat OVERNIGHT

    At least 160 000 men and women are hacking their diet with a simple and secret "water hack" to lose 2 lbs each night while they sleep.

    It is very easy and works on anybody.

    Here's how you can do it yourself:

    1) Go get a clear glass and fill it half full

    2) Proceed to use this proven HACK

    you'll become 2 lbs thinner the next day!

    ReplyDelete