[英]Symfony Error: [PDOException] SQLSTATE[HY000] [2002] No such file or directory
I just received some open project files form a customer, where I have to make some adjustments.我刚刚从客户那里收到了一些打开的项目文件,我必须在那里进行一些调整。 The project is based ons Symfony Framework and in order to get the project running on my machine, I have to set up the symfony workflow.该项目基于 Symfony 框架,为了让项目在我的机器上运行,我必须设置 symfony 工作流程。
I already installed all necessary dev dependencies I guess and when I start my app via:我猜我已经安装了所有必要的开发依赖项,当我通过以下方式启动我的应用程序时:
php bin/console server:run
I get following errors: [PDOException] SQLSTATE[HY000] [2002] No such file or directory我收到以下错误:[PDOException] SQLSTATE[HY000] [2002] 没有这样的文件或目录
I read couple of threads about this error and most people recommend changing the host from "127.0.0.1" to "localhost" and vice versa.我阅读了有关此错误的几个线程,大多数人建议将主机从“127.0.0.1”更改为“localhost”,反之亦然。
If i enter "localhost" to be my host, I end up with the error from above.如果我输入“localhost”作为我的主机,我最终会遇到上面的错误。
If I put "127.0.0.1" as my host, I get "connection refused" instead of "No such file or directory"如果我把“127.0.0.1”作为我的主机,我会得到“连接被拒绝”而不是“没有这样的文件或目录”
Run运行
app/console doctrine:schema:update --force应用程序/控制台原则:模式:更新 --force
to create the database and all the tables for the project.为项目创建数据库和所有表。
Let us know if anything of this works or does not.让我们知道这是否有效。
I had the same problem and fixed it by adding我遇到了同样的问题并通过添加来修复它
parameters:
#...
database_driver: pdo_mysql
in the app/parameters.yml
file.在app/parameters.yml
文件中。
You should also check if your database_(name|user|password)
values are correct.您还应该检查您的database_(name|user|password)
值是否正确。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.