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 was having similar issues connecting to OpenSUSE 13.1 MySQL database with LibreOffice. Update LibreOffice to latest stable "Still" package, then make sure the database is accessible using a tool such as phpMyAdmin. Make sure your user is linked to localhost and not "%" (any). This worked for me, I am able to add data thru LibreOffice.
Side note - LibreOffice Base will not supply "native connection" via MySQL on first attempt, you will need to use the back button, then try again to see the options.
Hope this helps.
You need to set the password for root@localhost
to be blank. There are two ways:
The MySQL SET PASSWORD
command:
SET PASSWORD FOR root@localhost=PASSWORD('');
Using the command-line mysqladmin
tool:
mysqladmin -u root -pCURRENTPASSWORD password ''
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"
Ok, so this might not fix your issue but it definitely worked for me.
So you've created your Mysql user I take it? Go to user privileges on PhpMyAdmin and click edit next to the user your using for Symfony. Scroll down to near the bottom and where it says which host you want to use make sure you've selected LocalHost not % Any.
Then in your config file swap 127.0.0.1 for localhost. Hopefully that will work for you. Just worked for me as I was having the same issue.
I dont know what is the exact reason but I solved the problem running:
app/console cache:clear --env=prod
Source: Stackoverflow.com