Connection failed: No such file or directory Mysql - WSL Sorry if i posted incorrect section.
I have Windows with this WSL:

PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian


On my WSL i installed php7.3-fpm and Nginx, i've tested and both were working. I can't installed mysql on WSL i've got much errors then i installed Mysql on my Window and created a simple database.

The problem is when i try to connect my database with this code:

&lt;?php
$servername = "localhost";
$username = "root";
$password = "root";

// Create connection
$conn = new mysqli($servername, $username, $password);

// Check connection
if ($conn-&gt;connect_error) {
    die("Connection failed ttt: " . $conn-&gt;connect_error);
}
echo "Connected successfully";
?&gt;


And I got this message:


  Connection failed: No such file or directory


I think it's because my Mysql is on Windows and php interpreter is on WSL and can't comunicate.
Someone can help me please.
in PHP  mysqli needs 4 Paarameters

https://www.php.net/manual/de/function.mysqli-connect.php

So it should be

&lt;?php
$servername = "localhost";
$username = "root";
$password = "root";
$database = "mydatabase";

// Create connection
$conn = new mysqli($servername, $username, $password,$database);

// Check connection
if ($conn-&gt;connect_error) {
    die("Connection failed ttt: " . $conn-&gt;connect_error);
}


echo "Connected successfully";
?>