如何使用Doctrine在基于Symfony2的网站上创建数据库?

This seems like it should be pretty easy but I am running into problems trying to create a database following these instructions: http://symfony.com/doc/master/book/doctrine.html

I edit the parameters.yml and config.yml file and then run this command from terminal:

php app/console doctrine:database:create

The error I am getting is:

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

How do I resolve this error and create the database?

The problem is that you are probably trying to connect on a server that isn't configured properly.

There is nothing to do with doctrine.

Tell me, are you trying to connect to a home-made server ? Is it a LAMP or WAMP stack ?

EDIT

If you are running on a recently installed server, you have to edit the MySQL configuration and set a password to the root account or set on the directive allowNullPassword

EDIT 2

If your server is LAMP, the file you have to change is located at /etc/my.cnf

EDIT 3 That file is for various mysql configurations. About the allow null i was mistaking with phpMyAdmin. Try setting a password for the root with this command
mysqladmin -u root password MYVERYNEWANDSECRETPASSWORD