Cannot create database connection for Doctrine2 in Symfony2 using MAMP (connection rejected)

I study Symfony2 for a project that some friends and I take over, and I take a tutorial where you make a blog in Symfony2: http://tutorial.symblog.co.uk/docs/doctrine-2-the-blog-model .html

Problem

I can not get Doctrine2 to work. I give the following command to the terminal:

php app/console doctrine:database:create

And get the following error message:

Failed to create database for connection named symfonySQLSTATE [HY000] [2002] Connection rejected

System Information

I have a mac that runs Mountain Lion and I use MAMP.

What I've done

(http://localhost/NameOfProject/web/config.php) , . , , , .. MAMP.

, , MAMP mysql :

sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock mysql.sock

.

symfony ( )

app/config/config.yml:

parameters:
    database_driver: pdo_mysql
    database_host: 127.0.0.1
    database_port: '8889'
    database_name: symfony
    database_user: root
    database_password: root
    mailer_transport: smtp
    mailer_host: 127.0.0.1
    mailer_user: null
    mailer_password: null
    locale: en
    secret: 0408312e2b9861c0c86dbb7488aceec4296054ec
    database_path: /Applications/MAMP/tmp/mysql/mysql.sock

app/config/parameters.yml:

parameters:
    database_driver: pdo_mysql
    database_host: 127.0.0.1
    database_port: '8889'
    database_name: symfony
    database_user: root
    database_password: root
    mailer_transport: smtp
    mailer_host: 127.0.0.1
    mailer_user: null
    mailer_password: null
    locale: en
    secret: 0408312e2b9861c0c86dbb7488aceec4296054ec
    database_path: /Applications/MAMP/tmp/mysql/mysql.sock

database_ * , app/config/parameters.ini. parameters.ini, ! parameters.yml.

: :

MySql. 3306, .

+5
1

MySql. 3306, mysql, . ( jperovic)

+8

All Articles