1

I have problems connecting to a server. Originally I was using UserSpice and had problems connecting so I decided to make a test with connecting manually with php but still got error(I am using MySQL Workbench) :

PHP Warning: mysqli_connect(): The server requested authentication method unknown to the client [caching_sha2_password] in C:\inetpub\wwwroot\test\index.php on line 8

PHP Warning: mysqli_connect(): (HY000/2054): The server requested authentication method unknown to the client in C:\inetpub\wwwroot\test\index.php on line 8

Here is my code:

<?php
  $servername = "localhost";
  $username = "test";
  $password = "";
  $DBname = "testing";

 $conn = mysqli_connect($servername, $username, $password, $DBname);

I am pretty useless when it comes to PHP as what I am doing is graphic and web design so if you can help I will be really grateful!!

Thank you!

u_mulder
  • 54,101
  • 5
  • 48
  • 64

1 Answers1

-1

Hi there kindly check your default username which is root, let me share the code

    <?php
  $servername = "localhost";
  $username = "root";
  $password = "";
  $DBname = "testing";

 $conn = mysqli_connect($servername, $username, $password, $DBname);

If it's work great, if not let me know.

Hamad
  • 161
  • 2
  • 12