Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony 2 SQLSTATE[HY000] [2002] Connection refused Error

I get an error like database operations using Symfony2.

SQLSTATE[HY000] [2002] Connection refused

parameters.yml

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

And console:

Kemal-Karakass-MacBook-Pro:~ kemalkarakas$ locate mysql.sock
/private/var/mysql/mysql.sock

How do I resolve the error?

like image 540
kemal Avatar asked Oct 28 '13 08:10

kemal


1 Answers

i had the same issue and fixed it changing

database_host: 127.0.0.1

to

database_host: localhost

in parameters.yml

hopefully this helps

like image 113
izus Avatar answered Oct 11 '22 17:10

izus