【问题标题】:Doctrine database creating symfony创建 symfony 的 Doctrine 数据库
【发布时间】:2021-06-22 20:25:13
【问题描述】:

我正在尝试使用命令“php bin/console dictionary:database:create”在 mySQL DB 中创建数据库 我得到这个错误:

In AbstractMySQLDriver.php line 128:

  An exception occurred in driver: could not find driver  


In Exception.php line 18:

  could not find driver  


In PDOConnection.php line 39:

  could not find driver

这是我的 .env 文件

###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
#
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
 DATABASE_URL="mysql://root:@127.0.0.1:3306/myDB"
# DATABASE_URL="postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=13&charset=utf8"
###< doctrine/doctrine-bundle ###

【问题讨论】:

  • 未安装 MySQL 扩展,因此 PHP 找不到数据库驱动程序。安装它。
  • 这能回答你的问题吗? PDOException could not find driver
  • 请确保您的系统或 docker 镜像上有 pdo_mysql 驱动程序,还必须安装 php-mysql 扩展程序

标签: symfony doctrine


【解决方案1】:
  1. 您需要检查 symfony 要求 symfony check:requirements
  2. 尝试安装php-mysql扩展,安装扩展后别忘了重启/重新加载你的服务器服务

【讨论】:

    猜你喜欢
    • 2013-11-30
    • 2016-07-18
    • 2022-01-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-04
    相关资源
    最近更新 更多