Error: connect ECONNREFUSED

I would like to connect php and my SQL Workbench database. The final goal for this independent project is that once I enter some personal data (password, address etc) into the textfield on index.php and those data show up on the Workbench.

I got stuck at the point where I connect the plug-ins Live Server and PHP Server with VS Code. My index.php is opened on my VS Code and I already installed both plug-ins there too. Once I clicked the Port:5050 to call the PHP Server/Live Server I only encounter the following error:

Error: connect ECONNREFUSED 

Could anyone point out what I might be able to fix here? I leave my codes here for your reference. Still, I do not look for a solution code but some hints I can work to resolve this problem myself.


<!DOCTYPE html>

<form action="includes/" method="POST">
<input type="text" name="first" placeholder="Firstname">
<input type="text" name="last" placeholder="Lastname">
<input type="text" name="email" placeholder="E-Mail">
<input type="text" name="uid" placeholder="Username">
<input type="password" name="pwd" placeholder="Password">
<button type="submit" name="submit">Sign up</button>


  include_once '';

  $first = $_POST['first'];
  $last = $_POST['last'];
  $email = $_POST['email'];
  $uid = $_POST['uid'];
  $pwd = $_POST['pwd'];

  $sql = "INSERT INTO users (user_first, user_last, user_email, user_uid, user_pwd)
  VALUES ('$first', '$last', '$email', '$uid', '$pwd');";
  mysqli_query($conn, $sql);

  header("Location: ../index.php?signup=success");
  $resultCheck = mysqli_num_rows($result);

  if($resultCheck > 0){
      while($row = mysqli_fetch_assoc($result)){
          echo $row['user_uid']."<br>";


include_once "includes/";

$dbServername = "localhost";
$dbUsername = "root";
$dbPassword = "morry329A";
$dbName = "Artikelliste";

$conn = mysqli_connect($dbServername, $dbUsername, $dbPassword, $dbName);


I actually found the solution myself.
Seems to me like the error came out as follows; the SQL database was inactive (my SQL was closed) as I edited the code on my VS Code.
I opened my SQL and also changed localhost to
If this does not work for you, you may change localhost to localhost:3306. The 3306 is where my SQL is located, so you might want to swap it to the port no. where your SQL is.