Compare passwords with sha256

Hi all

I have recently migrated to percona mysql to 5.7.23. I had some process to compare a password of a mysql user with a new one. If new password is different I change it for the new one.

To do that I use this mysql query

SELECT IF ((SELECT authentication_string from user WHERE User = 'myuser' AND Host = 'localhost') = PASSWORD('mypassword'), 'true', 'false') AS equal;
+-------+
| equal |
+-------+
| false |
+-------+

With PASSWORD() I can compare the current authentication_string with the password ‘mypassword’ and know if it is the current storaged password or I need/want change it.

But now, I have read that PASSWORD() is deprectated and it will delete in future release. OK. I want to change my passwords and create users with sha256 with this form

CREATE USER myuser@localhost IDENTIFIED WITH sha256_password by 'mypassword';

If want to change the password in the future (and in an automatized way) how I can compare the actual password (authentication string) with the new one and change it if they are different without using PASSWORD()? How could do that comparation with a mysql query similar to this but with sha256 and no PASSWORD() function and obtain if the storaged password are equal or not?

Thanks in advance

Regards