mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
I am unable to find the solution for this.
Just run
mysql -u root
This will not prompt for a password.
According to the official docs there are multiple cases:
There was set a random password during installation
mysqld --initialize
cat /var/log/mysql/error.log | grep root@localhost
mysql -u root -p
(in some cases you have to run this with sudo
)ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
There was not set a random password during installation
mysqld --initialize-insecure
mysql -u root --skip-password
(maybe you have to try also with sudo
)ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
Hope that helps.