@Veera Mundra
Please make sure that you are using correct MySQL root user credentials and able to logint o mysql using the "mysql client" as following:
# mysql -u root -p
Enter Password: <What_Ever_Is_Your_Root_Password>
.
If you do not know your root user password for mysql then you can reset it as mentioned in: https://dev.mysql.com/doc/refman/8.0/en/resetting-permissions.html
Stop the MySQL server if necessary, then restart it with the--skip-grant-tablesoption. This enables anyone to connect without a password and with all privileges, and disables account-management statements such asALTER USERandSET PASSWORD. Because this is insecure, if the server is started with the--skip-grant-tablesoption, it enables--skip-networkingautomatically to prevent remote connections
- Connect to the MySQL server using themysqlclient; no password is necessary because the server was started with
--skip-grant-tables:shell> mysql
- In the
mysqlclient, tell the server to reload the grant tables so that account-management statements work:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
.
Also please refer to : https://stackoverflow.com/questions/17975120/access-denied-for-user-rootlocalhost-using-password-yes...