If you forgot your mysql root password, not able to login to your mysql database. Don't worry this is the simplest way I could find to reset mysql root user password.
1. Stop MySQL Service
[root@manoj ~]# /etc/init.d/mysqld stop
2. Execute Following Command
1. Stop MySQL Service
[root@manoj ~]# /etc/init.d/mysqld stop
2. Execute Following Command
[root@manoj ~]# mysqld_safe --skip-grant-tables and Press ENTER
3. Now Let’s Login to MySQL Without Password[root@manoj ~]# mysql -u root4. Use Following Queries to Reset your MySQL root Passwordmysql> use mysql;mysql> update user set password=PASSWORD(“NEW-MYSQL-ROOT-PASSWORD”) where User=’root';mysql> flush privileges;mysql> quit5. Let’s Stop MySQL Server as we have started in Step 2[root@manoj ~]# service mysqld stop6. Now Start MySQL Service[root@manoj ~]# service mysqld start7. Execute Following Command to Login with New Password[root@manoj ~]# mysql -u root -pYou should now be able to connect to MySQL asrootusing the new password.
No comments:
Post a Comment