mysql – SQLSTATE [HY000] [1045]访问被拒绝用户’root’@’127.0.0.1′(使用密码:否)SYMFONY2

前端之家收集整理的这篇文章主要介绍了mysql – SQLSTATE [HY000] [1045]访问被拒绝用户’root’@’127.0.0.1′(使用密码:否)SYMFONY2前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

所以我一直在研究symfony2项目,这一切都很好,然后我想在godaddy上托管它,但现在我收到了这个错误.我不明白它也不知道如何解决它.非常感谢.

sqlSTATE[HY000] [1045] Access denied for user ‘root’@’127.0.0.1’ (using password: NO)

这是我的paramaters.yml文件

# This file is auto-generated during the composer install
parameters:
    database_driver: pdo_MysqL
    database_host: 127.0.0.1
    database_port: null
    database_name: symfony
    database_user: root
    database_password: 
    mailer_transport: smtp
    mailer_host: 127.0.0.1
    mailer_user: null
    mailer_password: null
    locale: en
    secret: 14bcde878eda1c3f56a59b62b13e820b7f94563d

这是我的config.yml文件

imports:
    - { resource: parameters.yml }
    - { resource: security.yml }

framework:
    #esi:             ~
    #translator:      { fallback: "%locale%" }
    translator: ~
    secret:          "%secret%"
    router:
        resource: "%kernel.root_dir%/config/routing.yml"
        strict_requirements: ~
    form:            ~
    csrf_protection: ~
    validation:      { enable_annotations: true }
    templating:
        engines: ['twig']
        #assets_version: SomeVersionScheme
    default_locale:  "%locale%"
    trusted_hosts:   ~
    trusted_proxies: ~
    session:
        # handler_id set to null will use default session handler from PHP.ini
        handler_id:  ~
    fragments:       ~
    http_method_override: true

# Twig Configuration
twig:
    debug:            "%kernel.debug%"
    strict_variables: "%kernel.debug%"

# Assetic Configuration
assetic:
    debug:          "%kernel.debug%"
    use_controller: false
    bundles:        [ ]
    #java: /usr/bin/java
    filters:
        cssrewrite: ~
        #closure:
        #    jar: "%kernel.root_dir%/Resources/java/compiler.jar"
        #yui_css:
        #    jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"

# Doctrine Configuration
doctrine:
    dbal:
        driver:   "%database_driver%"
        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,add the path in parameters.yml
        # e.g. database_path: "%kernel.root_dir%/data/data.db3"
        # path:     "%database_path%"

    orm:
        auto_generate_proxy_classes: "%kernel.debug%"
        auto_mapping: true

# Swiftmailer Configuration
swiftmailer:
    transport: "%mailer_transport%"
    host:      "%mailer_host%"
    username:  "%mailer_user%"
    password:  "%mailer_password%"
    spool:     { type: memory }

fos_user:
    db_driver: orm # other valid values are 'mongodb','couchdb' and 'propel'
    firewall_name: main
    user_class: CurrencyConverter\ConverterBundle\Entity\User1
sensio_framework_extra:
    view:
        annotations: false
fos_rest:
    param_fetcher_listener: true
    body_listener: true
    format_listener: true
    view:
        view_response_listener: 'force'

我现在得到了密码和用户名

sqlSTATE[HY000] [2002] PHP_network_getaddresses: getaddrinfo Failed: Name or service not known

最佳答案
您的database_user和database_password值需要在parameters.yml文件中设置.您可以在提供给您的GoDaddy新帐户设置电子邮件获取这些设置.

猜你在找的MySQL相关文章