0

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     
1
  • I suggest you to create another user, grant needed privileges to this user and work with it. Don't use root in your app, it's bad practice. Commented Jul 11, 2016 at 5:18

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.