title: Symfony 2 SQLSTATE[HY000] [2002] Connection refused Error
body: <p>I get an error like database operations using Symfony2.</p>
  
  <pre><code>SQLSTATE[HY000] [2002] Connection refused
  </code></pre>
  
  <p>parameters.yml</p>
  
  <pre><code>parameters:
    database_driver: pdo_mysql
    database_host: 127.0.0.1
    database_port: '8889'
    database_name: symfony
    database_user: root
    database_password: root
    mailer_transport: smtp
    mailer_host: 127.0.0.1
    mailer_user: null
    mailer_password: null
    locale: tr
    secret: ef9b4381fe75208f060b7c786951242bebcfb3c2
    database_path: /private/var/mysql/mysql.sock
  </code></pre>
  
  <p>And console:</p>
  
  <pre><code>Kemal-Karakass-MacBook-Pro:~ kemalkarakas$ locate mysql.sock
  /private/var/mysql/mysql.sock
  </code></pre>
  
  <p>How do I resolve the error?</p>