简体   繁体   English

教义的MySQL错误1045(使用密码:否),即使有密码并且是正确的

[英]Doctrine MySQL Error 1045 (Using Password: NO) even though there is a password and it's correct

I keep getting this when trying to create a database in Doctrine (I'm using Symfony 3.1.4): 尝试在Doctrine中创建数据库时,我一直收到此消息(我正在使用Symfony 3.1.4):

An exception occured in driver: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO)` 驱动程序中发生异常:SQLSTATE [HY000] [1045]用户'root'@'localhost'的访问被拒绝(使用密码:NO)`

From what I gather, this error pops up when trying to connect to MySQL when the user has no password or it's incorrect. 据我所知,当用户没有密码或密码不正确时,尝试连接到MySQL时会弹出此错误。 But this is not my case. 但这不是我的情况。

parameters.yml is as follows: parameters.yml如下:

# This file is auto-generated during the composer install parameters:
database_host: 127.0.0.1
database_port: 8080
database_name: symfony_db
database_user: root
database_password: password
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: null
mailer_password: null
secret: secret`

And config.yml... 和config.yml ...

# Doctrine Configuration
doctrine:
    dbal:
        driver:   pdo_mysql
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"
        charset:  UTF8`

So, nothing seems to be wrong here. 因此,这里似乎没有错。 MySQL does have a password, and the one in parameters.yml is exactly the same I use in phpmyadmin and used to work when using Laravel. MySQL确实有一个密码,而parameters.yml中的密码与我在phpmyadmin中使用的密码完全相同,并且在使用Laravel时可以正常使用。

Thanks in advance. 提前致谢。

So, I managed to fix it. 因此,我设法修复了它。

As mentioned in the comments, I did skim through the Symfony installation instructions to change it all later in parameters.yml, but what happened was that Symfony didn't do anything new when I change config.yml and parameters.yml, only the initial parameters stood. 就像评论中提到的那样,我确实浏览了Symfony安装说明,稍后再在parameters.yml中对其进行更改,但是发生的是,当我更改config.yml和parameters.yml时,Symfony并没有做任何新的事情,只有初始的参数不变。

And I finally found out why, courtesy of some helpful person on the #symfony IRC channel: while I was changing configurations, the wrong information I initially inserted during installation was cached , so all I had to do was to run php bin/console doctrine:cache:clear on the command line before connecting. 最后,我发现了原因,在#symfony IRC频道上有人帮助:在我更改配置时, 缓存了我最初在安装过程中插入的错误信息 ,因此我要做的就是运行php bin/console doctrine:cache:clear连接前在命令行上php bin/console doctrine:cache:clear

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 即使我的用户名和密码正确,也获得“警告:mysqli_connect():( 2800/1045)” - Getting “Warning: mysqli_connect(): (2800/1045)” even though my username and password are correct 显示错误的密码或用户名,即使它是正确的密码或用户名 - showing wrong password or username even though it is correct password or username 发生MySQL查询错误。 错误号:1045用户“ root” @“ localhost”的访问被拒绝(使用密码:否) - A MySQL query error has occurred. Error number: 1045 Access denied for user 'root'@'localhost' (using password: NO) 我在 ubuntu 上使用命令 sudo mysql 收到 ERROR 1045 (28000): Access denied for user 'root'@'localhost'(使用密码:NO) - I got ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) with the command sudo mysql on ubuntu Mac OS X 10.9上的MYSQL#1045错误(使用我的密码) - MYSQL #1045 error on mac os x 10.9 (with my password) MySQL错误:SQLSTATE [HY000] [1045]用户'test'@'localhost'的访问被拒绝(使用密码:是) - MySQL error: SQLSTATE[HY000] [1045] Access denied for user 'test'@'localhost' (using password: YES) mysql 错误 SQLSTATE[HY000] [1045] 用户 'root'@'localhost' 的访问被拒绝(使用密码:NO) - mysql error SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) 用户 'ODBC'@'localhost' 的错误 1045 访问被拒绝(不使用密码) - Error 1045 access denied for user 'ODBC'@'localhost' (using password no) 即使输入的信息正确,也会出现“错误的用户名或密码”消息 - "Wrong username or password" message even though informations typed are correct Symfony-理论:用户'root'@'localhost'的SQLSTATE [HY000] [1045]访问被拒绝(使用密码:是) - Symfony - doctrine: SQLSTATE[HY000] [1045] access denied for user 'root'@'localhost' (using password: YES)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM