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

MySQLsymfonyUbuntu

I tried to create my DB with Symfony2 typing the command below:

php app/console doctrine:create:database

The result is:

Could not create database for connection named jobeet
SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: YES)

The contents of my app/config/parameters.yml file is:

parameters:
   database_driver:   pdo_mysql
   database_host:     127.0.0.1
   database_port:     ~
   database_name:     jobeet
   database_user:     root
   database_password: 0000

   mailer_transport:  smtp
   mailer_host:       127.0.0.1
   mailer_user:       ~
   mailer_password:   ~

   locale:            fr
   secret:            ThisTokenIsNotSoSecretChangeIt

My OS is Ubuntu.

I don't know what to do to correct this problem.

Best Answer

Try to login via the terminal using the following command:

mysql -u root -p

It will then prompt for your password. If this fails, then definitely the username or password is incorrect. If this works, then your database's password needs to be enclosed in quotes:

database_password: "0000"