How to Reset mysql root password without known old password For Centos and Fedora

1. service mysqld stop
2. mysqld_safe --skip-grant-tables &
3. if error comes then create mkdir -p /var/run/mysqld and then give permission chown mysql:mysql /var/run/mysqld
and then again run 2 step
4. mysql
5. UPDATE mysql.user SET authentication_string=PASSWORD("password") WHERE User='root';
6. FLUSH PRIVIlEGES;
7. quit
8. then stop mysqld_safe command
9. service mysqld start

Leave a Reply

Your email address will not be published. Required fields are marked *