in access denied for user ‘root’@’localhost’
$ ./mysqladmin -u root -p ‘redacted’
Enter passwordmysqladmin: connect to server at ‘localhost’ failed error:
‘Access denied for user ‘root’@’localhost’ (using password: YES)’
error 1045 (28000): access denieds for user ‘root’@’localhost’ (using password: yes)
access denieds for user ‘root’@’localhost’ (using password yes) when trying to connect
This solution does not need to drop any Database tables or no need to update or change any user types of the permission. just two line of code and then you will able to login into MySql console.
MySQL Error: ‘Access denied for user ‘root’@’localhost’
error 1045 (28000): access denieds for user ‘root’@’localhost’ (using password: yes)
Detailed Solution :
- Open & Edit /etc/my.cnf or /etc/mysql/my.cnf, depending on your distro.
- Add skip-grant-tables under [mysqld]
- Restart Mysql
- You should be able to login to mysql now using the below command mysql -u root -p
- Run mysql> flush privileges;
- Set new password by ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘NewPassword’;
- Go back to /etc/my.cnf and remove/comment skip-grant-tables
- Restart Mysql
Now you will be able to login with the new password mysql -u root -p
Fast Solution :
mysqli_real_connect(): (hy000/1045): access denieds for user ‘root’@’localhost’ (using password: no)
how to fix access denied for user ‘root’@’localhost’ Follow given steps.
- ~ sudo su
- ~ mysql -u root -p
- *enter your password*
- ~ update mysql.user set plugin = ‘mysql_native_password’ where User=’root’;
- ~ FLUSH PRIVILEGES;
- ~ exit;