Tuesday 16 July 2019

Solution for Mysql error: access denied for user 'root'@'localhost'

                  In this post, we will see solution for the mysql error access denied for user 'root'@'localhost'. 


                  After installing Mysql in linux (In Ubuntu, by running command sudo apt-get install mysql-server), when we open mysql by running following command
mysql -u root -p

                We may get error mysql access denied for user 'root'@'localhost'.

                There are many solutions available on net. Best solution I found is as follows:

Run following command in terminal:

sudo mysql

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';

              It works for me. Hope it will helpful for you. It changes mysql root password to root.

Thanks a lot.

No comments:

Post a Comment