简体   繁体   English

Symfony 错误:[PDOException] SQLSTATE[HY000] [2002] 没有这样的文件或目录

[英]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”作为我的主机,我会得到“连接被拒绝”而不是“没有这样的文件或目录”

  1. Make sure your local mysql service is running as well.确保您的本地 mysql 服务也在运行。
  2. Check database configuration in yaml.检查 yaml 中的数据库配置。 Make sure the connection to your local mysql is correct.确保与本地 mysql 的连接正确。
  3. 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.

相关问题 PDOException SQLSTATE[HY000] [2002] 没有那个文件或目录 - PDOException SQLSTATE[HY000] [2002] No such file or directory PDOException: SQLSTATE[HY000] [2002] 没有那个文件或目录 - PDOException: SQLSTATE[HY000] [2002] No such file or directory Laravel 4和宝塔:[PDOException] SQLSTATE [HY000] [2002]没有这样的文件或目录 - Laravel 4 & Pagoda: [PDOException] SQLSTATE[HY000] [2002] No such file or directory 工匠错误“错误”:{“类型”:“ PDOException”,“消息”:“ SQLSTATE [HY000] [2002]没有这样的文件或目录”,“文件”: - Artisan error “error”:{“type”:“PDOException”,“message”:“SQLSTATE[HY000] [2002] No such file or directory”,“file”: Symfony SQLSTATE[HY000] [2002] 没有这样的文件或目录数据库连接 - Symfony SQLSTATE[HY000] [2002] No such file or directory database connection Symfony3 - SQLSTATE[HY000] [2002] 没有这样的文件或目录 - Symfony3 - SQLSTATE[HY000] [2002] No such file or directory Symfony 5 - SQLSTATE[HY000] [2002] 没有这样的文件或目录 - Symfony 5 - SQLSTATE[HY000] [2002] No such file or directory SQLSTATE[HY000] [2002] 没有那个文件或目录 - SQLSTATE[HY000] [2002] No such file or directory 错误:SQLSTATE[HY000] [2002] 没有那个文件或目录 - Error: SQLSTATE[HY000] [2002] No such file or directory Magento安装SQLSTATE [HY000] [2002]没有此类文件或目录错误 - Magento Installation SQLSTATE[HY000] [2002] No such file or directory error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM