I am using php mysqli_connect for login to a MySQL database (all on localhost)
mysqli_connect
Now you can upgrade to PHP7.4 and MySQL will go with caching_sha2_password by default, so default MySQL installation will work with mysqli_connect No configuration required.
caching_sha2_password