title: Can't Connect to MySQL Server on IPAddress (10061)
body: <p>I need to connect to a remote MySQL database and have created the following connection code:</p>
  
  <pre><code>&lt;?php
  /* Set Variables */
  $host="myipaddress";
  $db="mydbname"; 
  $username="dbuser";
  $pass="mypass";
  
  /* Attempt to connect */
  $mysqli=new mysqli($host,$username,$pass,$db);
  if (mysqli_connect_error()){
  die('Connect Error (' . mysqli_connect_errno() . ') '
  . mysqli_connect_error());
  echo 'Success... ' . $mysqli-&gt;host_info . "\n";
  
  $mysqli-&gt;close();
  
  }
  ?&gt;
  </code></pre>
  
  <p>For security reasons, I've not provided the actual variable values.  When I run this on my development system, I receive</p>
  
  <pre><code>Connect Error (2003) Can't connect to MySQL server on 'myipaddress' (10061)
  </code></pre>
  
  <p>My PHP is a bit rusty, can someone identify where my code is faulty?  Note that dbuser has select, insert and update privileges on the database name set as the variable.</p>
  
  <p>Thanks,
  Sid</p>
  
  <p><strong>Edit</strong>
  I made changes to my.cnf and restarted mysql.  I now receive access denied for user 'dbuser'@'mycurrenthostname' (using password YES).  When I use mysql -u dbuser -p from command line, I can login.  I granted insert, update and select to dbuser with host '%' so that dbuser could connect from anywhere.  </p>
  
  <p>I've read the MySQL Reference guide about this error, but am still stuck.  Is there a problem with my code, now that my.cnf has been fixed?</p>