I have installed mysql server on 3 different servers (all Ubunutu 18.04). According to almost all the installation tutorials, after installation I am suppose to run sudo mysql_secure_installation
where, among other things, the root password is set. However, after this utility runs, I am still not able to access mysql using the following:
mysql -u root -p
>ERROR 1698 (28000): Access denied for user 'root'@'localhost'
What I have to do is sudo
into mysql and alter the root password using the following:
sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'pass123';
Why can I not log in as root after setting the password with mysql_secure_installation
? I feel like I am missing something.