Did you forget the root password for your mysql database? Don’t fret. Follow these simple steps to reset it. You will need to have root access to your server to do this.
(I’m performing this on a debian/ubuntu server. The redhat/fedora command for stopping/starting the mysql service will be very similar)
(1) Stop your database
$ sudo service mysql stop
(2) Start the database in a full access and full privilege mode
$ sudo mysqld_safe –skip-grant-tables –skip-networking &
(3) Logon without a password
$ mysql -u root mysql
(4) Reset the password
mysql> update user set Password=PASSWORD(‘my_new_password”) where user=’root’;
mysql> flush privileges;
(5) Kill the running database and restart it as normal.
$ sudo pkill mysqld
$ sudo service mysql start
You should be able to logon now with your new password.