How to resolve the error 1045 (28000): access denied for user 'root'@'localhost' (using password: yes)?
UBUNTU 22.04.1, mysql ver 8.0.30
(1) I get sudo apt install mysql-server then
sudo mysql_secure_installation
Get in loop this error for each complicated passwords I tried: (contained: '<>&(*Pp1') returns↓
Failed! Error: SET PASSWORD has no significance for user ‘root’@’localhost’ as the authentication method used doesn’t store authentication data in the MySQL server. Please consider using ALTER USER instead if you want to change authentication parameters.
(2) Then try: sudo mysql alter user 'root'@'localhost' identified with mysql_native_password by 'password';
(3) Now ever returns:
error access denied for user 'root'@'localhost' (using password: YES) error 1045 (28000): access denied for user 'root'@'localhost' (using password: yes)
(4)
Then try
sudo apt-get remove --purge mysql*
sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get remove dbconfig-mysql
sudo apt-get dist-upgrade
sudo apt-get install mysql-server
(5)
Now ever shows:
ERROR 1045 (28000)
or
access denied for user 'root'@'localhost'
I can not refresh mysql with reinstall.
How can I retrieve the mysql and start step (1) newly cleaned from pre password configurations?
To resolve the error 1045 (28000): access denied for user 'root'@'localhost' (using password: yes) -
sudo dpkg-reconfigure mysql-server-8.0
( use sudo dpkg --get-selections | grep sql to get your version)
completely remove MySQLconfig and data?
sudo rm -r /var/lib/mysql
(Users and passwords (including the root password) are stored in the database itself, and the default data dir is /var/lib/mysql.)