I write sanity check script for an application. One of the tests is supposed to verify that a given user@host with 'password' exists in MySQL. I'm using simple native hash passwords. In MySQL5.7- there is the
PASSWORD() function that allows me to query
mysql.user and verify that the user exists and the passwords match. Is there a way to accomplish this in MySQL8.0+? Documentation page for
PASSWORD() in MySQL 5.7 does not provide any alternatives and the function is removed in MySQL 8.0.
I could simply try to add the user again, but I feel my script should know and register an event of missing user with expected credentials.
Please note that I do not necessarily need to generate password hash, I just want to verify that given user/password exists. This needs to be automated so solutions like 'try to log in with user/password from host machine' do not count as I may not have access to the host machine