'MySQL Access denied to root user
i have recently installed MySQL *Ver 8.0.28-0ubuntu0.20.04.3 for Linux on x86_64 ((Ubuntu))*
after installation when i try to access my shell its showing
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
both with or without sudo, i know this has answers on stack and other forums but none seems to help me, i have tried reinstalling MySQL server but that also didn't help, i tried skip grant option and then changing root password but that failed as well , need help in this , thank you
Solution 1:[1]
You can reset the password with one downtime. Just simply follow the below steps for 8 version.
- Stop the Mysql service $ systemctl stop mysql
- Now run Mysql service with skip grant tables mode. $ mysqld_safe --skip-grant-tables &
- Now login the service $ mysql -uroot
- execute flush privileges query
- execute alter query $ alter user 'root'@'localhost' identified by 'password';
- Now stop the mysql service $ systemctl stop mysql
- now restart the mysql service $ systemctl restart mysql
- Now try to login using the updated password
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | CHARAN CHINTHA |
