[PDOException]: SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO) Symfony2

折月煮酒 提交于 2019-12-02 06:09:46

问题


I tried to create my DB with Symfony2. I used the command:

php app/console doctrine:create:database

The result is:

[PDOException] : SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO)

This is my parameters.yml

parameters:
database_driver: pdo_mysql
database_host: 127.0.0.1
database_port: null
database_name: symfony
database_user: root
database_password: null
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: null
mailer_password: null
locale: en
secret: ThisTokenIsNotSoSecretChangeIt
debug_toolbar: true
debug_redirects: false
use_assetic_controller: true

and this is my config.yml :

doctrine:
dbal:
    default_connection:   default
    connections:
        default:
            driver:   %database_driver%
            host:     %database_host%
            port:     %database_port%
            dbname:   %database_name%
            user:     %database_user%
            password: %database_password%
            charset:  UTF8
    types:
        json: Sonata\Doctrine\Types\JsonType

Any help?


回答1:


You have to check your MySQL credentials. PDO was not able to connect to your MySQL server. Maybe the login is wrong, or the password, or user has not enough rights.



来源:https://stackoverflow.com/questions/24673614/pdoexception-sqlstate28000-1045-access-denied-for-user-rootlocalhost

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!