我在我的公司项目(laravel9)中安装了sanctum。当我使用命令“php artisan migrate”它出错“在ConnectionFactory.php行274:不支持的驱动程序[mongodb]"。
当我使用mysql时,在我的.env文件中数据库是mysql。这是上述文件的错误部分(ConnectionFactory.php行274).
protected function createConnection($driver, $connection, $database, $prefix = '', array $config = [])
{
if ($resolver = Connection::getResolver($driver)) {
return $resolver($connection, $database, $prefix, $config);
}
return match ($driver) {
'mysql' => new MySqlConnection($connection, $database, $prefix, $config),
'pgsql' => new PostgresConnection($connection, $database, $prefix, $config),
'sqlite' => new SQLiteConnection($connection, $database, $prefix, $config),
'sqlsrv' => new SqlServerConnection($connection, $database, $prefix, $config),
default => throw new InvalidArgumentException("Unsupported driver [{$driver}]."),
};
}
有什么问题吗?
1条答案
按热度按时间km0tfn4u1#
将
DB_CONNECTION
从MongoDB更改为MySQL或支持的数据库驱动程序之一。支持的驱动程序:
mysql
pgsql
sqlite
sqlsrv