I keep getting the following error on running sudo **mysql_secure_installation**
... 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.
Any help will be appreciated.
Updated:
solved it by running sudo mysql which logged me in as root without a password, then I ran ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by 'mynewpassword';
Following this, I was able to run mysql_secure_installation
again and this time I got to choose to use the existing password (the one I set with above SQL command).
However now I can no longer login without a password, running sudo mysql
now denies root user access:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
How can I log in back using sudo mysql
again?