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

前端之家收集整理的这篇文章主要介绍了Symfony 2 SQLSTATE [HY000] [2002] Connection refused Error前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我收到使用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

和控制台:

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

如何解决错误

您可以在config.yml中使用参数unix_socket.

查看完整配置示例:

# Doctrine Configuration
doctrine:
    dbal:
        default_connection: default
        connections:
            default:
                driver:   %database_driver%
                dbname:   %database_name%
                user:     %database_user%
                host:     %database_host%
                password: %database_password%
                unix_socket: /tmp/MysqL.sock
原文链接:https://www.f2er.com/php/131082.html

猜你在找的PHP相关文章