데이터베이스와의 연결을 만들어야하는 전자 상거래 자습서를 따르려고합니다. 나는 xampp v3.2와 함께 윈도우 7에있다. 빈/콘솔이 생성 PHP : 교리 : 엔티티 날이 오류를 제공합니다이 SQLSTATE [HY000] [2002] 해결 방법 대상 컴퓨터에서 적극적으로 거부했기 때문에 연결할 수 없습니다.
그래서 나는 이것을 사용
대상 컴퓨터가 적극적으로 거부했기 때문에 SQLSTATE는 [HY000] [2002] 연결하지 못했습니다그것
내가 xampp를 닫았는데 나는 여전히 같은 오류가 있었다. 그래서 나는 그것이 구성에서 온 것임을 이해합니다. 어떻게 든 내 셸 xampp에서 내 SQL 서버와 통신하지 않습니다.
여기 내 parameters.yml입니다 :
# This file is auto-generated during the composer install
parameters:
database_host: localhost
database_port: 3306
database_name: market
database_user: sebastian
database_password:
mailer_transport: smtp
mailer_host: localhost
mailer_user: null
mailer_password: null
secret:
여기 내 config.yml
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.yml }
- { resource: "@EcommerceBundle/Resources/config/services.yml" }
# Put parameters here that don't need to change on each machine where the app is deployed
# http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
locale: en
framework:
#esi: ~
#translator: { fallbacks: ["%locale%"] }
secret: "%secret%"
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
#serializer: { enable_annotations: true }
templating:
engines: ['twig']
default_locale: "%locale%"
trusted_hosts: ~
trusted_proxies: ~
session:
# http://symfony.com/doc/current/reference/configuration/framework.html#handler-id
handler_id: session.handler.native_file
save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%"
fragments: ~
http_method_override: true
assets: ~
# Twig Configuration
twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"
# Doctrine Configuration
doctrine:
dbal:
driver: pdo_mysql
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
# if using pdo_sqlite as your database driver:
# 1. add the path in parameters.yml
# e.g. database_path: "%kernel.root_dir%/data/data.db3"
# 2. Uncomment database_path in parameters.yml.dist
# 3. Uncomment next line:
# path: "%database_path%"
orm:
auto_generate_proxy_classes: "%kernel.debug%"
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
# Swiftmailer Configuration
swiftmailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory }
내가 확장 php_pdo_mysql.dl 점검하고이를 사용할 수 있습니다.
데이터베이스 이름, 사용자 및 암호를 확인했습니다. netstat
에 대한
감사 데이터베이스에 필요한 암호가없는 parameters.yml'. 그것은 당신에 의해 제거되었거나 정말로 비밀 번호가 필요하지 않은가요? – geoB
비밀도 마찬가지입니다! –
설치 symfony를 만들 때 database_port : 8080을 주었고 내 포트를 database_port : 3306으로 변경 한 후이 문제가 발생하여 문제가 해결되었습니다. –