【发布时间】: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 扩展程序