Stefano Maglione
Stefano Maglione

Reputation: 4160

Symfony, access to db denied for root user by console

I am facing this issue when I try to create a db with:

php bin/console doctrine:database:create

[Doctrine\DBAL\Exception\DriverException]                                         
An exception occured in driver: SQLSTATE[HY000] [1698] Access denied  for user 'r  
oot'@'localhost'  

I am sure that my user and password are correct because I can access to Sql databases by sql console. This is my symfony configuration:

#config.yml
doctrine:
dbal:
    driver:   pdo_mysql
    host:     "%database_host%"
    port:     "%database_port%"
    dbname:   "%database_name%"
    user:     "%database_user%"
    password: "%database_password%"
    charset:  UTF8
    # if using pdo_sqlite as your database driver:
    #   1. add the path in parameters.yml
    #     e.g. database_path: "%kernel.root_dir%/data/data.db3"
    #   2. Uncomment database_path in parameters.yml.dist
    #   3. Uncomment next line:
    #     path:     "%database_path%"

orm:
    auto_generate_proxy_classes: "%kernel.debug%"
    naming_strategy: doctrine.orm.naming_strategy.underscore
    auto_mapping: true                   


#parameters.yml
parameters:
database_host: 127.0.0.1
database_port: 3306
database_name: foreigners
database_user: root
database_password: Filip
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: null
mailer_password: null
secret: d0c1b2a4aff786d87c8900e1a9631184ddd600bf     

Upvotes: 0

Views: 784

Answers (1)

Tsounabe
Tsounabe

Reputation: 2184

To be sure you have the needed privileges i would try to create the database from the SQL console.

Upvotes: 1

Related Questions