title: Connection refused for connecting with MySQL server using php in XAMPP(MacOS)
body: <p>I am new to database. I was trying to connect mysql server with php code. But I don't know why I am getting error for connection.(I tried in windows changing the "localhost:8080" to "localhost" and it worked perfectly.)</p>
  
  <p><strong>MyCode:</strong></p>
  
  <pre><code>&lt;?php
  
  $link = mysqli_connect("localhost:8080","root","","test1");
  
  if($link === false){
      die("Error: Could not connect. ".mysqli_connect_error());
  }
  </code></pre>
  
  <p><strong>Refused Warning:</strong>
  <a href="https://i.stack.imgur.com/DeFBR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DeFBR.png" alt="enter image description here"></a></p>
  
  <p><strong>XAMPP Port:</strong>
  <a href="https://i.stack.imgur.com/C1r5v.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/C1r5v.png" alt="enter image description here"></a></p>