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.
In your app/config/parameters.yml
# This file is auto-generated during the composer install
parameters:
database_driver: pdo_mysql
database_host: 127.0.0.1
database_port: 3306
database_name: symfony
database_user: root
database_password: "your_password"
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: null
mailer_password: null
locale: en
secret: ThisTokenIsNotSoSecretChangeIt
The value of database_password
should be within double or single quotes as in: "your_password"
or 'your_password'
.
I have seen most of users experiencing this error because they are using password with leading zero or numeric values.
I dont know what is the exact reason but I solved the problem running:
app/console cache:clear --env=prod
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With