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

symfonysymfony-2.5

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?

Best Answer

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.

Related Topic