I am using php mysqli_connect for login to a MySQL database (all on localhost)
mysqli_connect
I tried this in Ubuntu 18.04 and is the only solution that worked for me:
ALTER USER my_user@'%' IDENTIFIED WITH mysql_native_password BY 'password';