There can be chances you lost root password and need to reset it. Following are steps mentioned below.
Error
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Steps :
System Preferencs
Stop mysql server
Login to terminal
Sudo pkill mysqld
cd /usr/local/mysql/bin
Sudo mysqld_safe --skip-grant-tables --skip-networking
cd /usr/local/mysql/bin
mysql -u root
FLUSH PRIVILEGES;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Test@1234’;
FLUSH PRIVILEGES;
Quit;
Sudo pkill mysqld
15 окт 2024