php mysqli_connect: authentication method unknown to the client [caching_sha2_password]

前端 未结 11 2481
遥遥无期
遥遥无期 2020-11-22 03:40

I am using php mysqli_connect for login to a MySQL database (all on localhost)



        
11条回答
  •  青春惊慌失措
    2020-11-22 03:57

    I solve this by SQL command:

    ALTER USER 'mysqlUsername'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mysqlUsernamePassword';
    

    which is referenced by https://dev.mysql.com/doc/refman/8.0/en/alter-user.html

    if you are creating new user

     CREATE USER 'jeffrey'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
    

    which is referenced by https://dev.mysql.com/doc/refman/8.0/en/create-user.html

    this works for me

提交回复
热议问题