简体   繁体   中英

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     

为确保您具有所需的特权,我将尝试从SQL控制台创建数据库。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM