1

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.

noslenkwah
  • 1,702
  • 1
  • 17
  • 26
  • Same problem on 20.04 - this really never seems to work. After doing mysql_secure_installation with setting a root password now i still can login to mysql without password and when i try to login with root credentials (from php script) it tells me those are the wrong credentials. –  Dec 01 '20 at 12:16

0 Answers0