title: SQLSTATE[HY000] [2002] No such file or directory , how to solve?
body: <p>Working with PDO Class I've got a problem with a PHP socket connection.</p>
  
  <p>After searching, I looked at <a href="https://stackoverflow.com/questions/20723803/pdoexception-sqlstatehy000-2002-no-such-file-or-directory">this link</a> and couldn't find any appropriate answer for me. </p>
  
  <p>I using macOS Sierra Version 10.12.6</p>
  
  <p>I tried to get some information from <code>mysql&gt; show variables like '%sock%'</code> but didn't get any result from mysql shell. I logged successfully.</p>
  
  <p>Don't have any <code>my.cnf</code> file in my <code>/etc</code> folder.  </p>
  
  <p>This is the result I got from <code>php -i | grep pdo</code>:</p>
  
  <pre><code>pdo_mysql.default_socket =&gt; /var/mysql/mysql.sock =&gt; /var/mysql/mysql.sock
  </code></pre>
  
  <p>I am not using Laravel.</p>
  
  <p>I changed configuration in my <code>php.ini</code> file to <code>pdo_mysql.default_socket=/var/mysql/mysql.sock</code>, but it still does not work.</p>
  
  <p>How can I connect PHP and MySQL working properly on same socket connection? </p>