title: ERROR 2003 (HY000): Can't connect to MySQL server on 'hostname' (111)
body: <p>Thanks in advance for your help.</p>
  
  <p>I am facing an issue with mysql server which is the title of this topic, by using the command:</p>
  
  <pre><code>mysql -u myuser -pmypass -h `hostname`  db_name
  </code></pre>
  
  <p>I get the error</p>
  
  <pre><code>ERROR 2003 (HY000): Can't connect to MySQL server on 'hostname' (111)
  </code></pre>
  
  <p>So I checked the <em>my.cnf</em> file and I have no lines with "bind address" and "skip-networking" although I tried adding them and restarting which did not change anything.</p>
  
  <p>Besides that there is no error in the sql logs, and we can (with HeidiSQL) connect to the server remotely knowing that the user is <code>myuser"@"%</code>. Mysql listens on the port 3306, so it's ok there</p>
  
  <p>Also, users created with with @'localhost', works fine with the command line (without the -h option). </p>
  
  <p>What is more intriguing is that other servers that look exactly the same work both locally and remotely with the first command...</p>
  
  <p>The server runs with CentOS 6.2</p>
  
  <p>So if anyone has an idea on this matter I would be glad to hear it</p>
  
  <p>P.S : It's my first time posting here, so if there are formatting issues, please forgive me</p>