Mysql – Why has the root password changed after I updated MySQL from 5.7 to 8.0

MySQLpasswordupgrade

I have set my root account passwords like this:

mysql -u root
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('pswd1');
SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('pswd2');
SET PASSWORD FOR 'root'@'::1' = PASSWORD('pswd3');

I had MySQL 5.6.47 Then I updated to 5.7.31 and everything was ok. Then I updated to 8.0.21 and immediately faced with 2 problems:

  1. MySQL wouldn't start but end up with 1053 error. The problem was in missing Visual C++ Redistributable dll file.
  2. In order to login into my root account I have to type the pswd3 password which had been set for the 'root'@'::1' account. pswd1 and pswd2 won't work anymore.

What may be the problem here?

Best Answer

MYSQL changed the default

If you chosen

Use Strong Password Encryption for Authentication (RECOMMENDED)

mysql 8.x uses the new authentication based on improved, stronger SHA256-based password methods.

https://dev.mysql.com/doc/mysql-installer/en/server-authentication-method.html

when you and your apps don't support it, you have to choose the legacy mode

But you can use user with the old authentficationwhen you use

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '<password>';

You have to add native password to all your roo

'root'@'::1' refers ipv6 localhost

'root'@'127.0.0.1' And 'root'@'localhost' zto ip V4

As you connect via 1pv6 change this apsword as well but use 'root'@'::1'`

localhoszt and 127.0.0.1 only work on a computer itself not over a network

how you can bind the server to ipv4 or ipv6 is described here https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html

And as last poit see upgrade instructions in mysql, you can't only exchange the exe https://dev.mysql.com/doc/refman/8.0/en/upgrading.html