Laravel 5 PDOException找不到驱动程序

我在使用Laravel 5时遇到问题。当我运行“ php aritsan migration”时,出现此错误


**************************************

*     Application In Production!     *

**************************************


Do you really wish to run this command? [y/N] y


[PDOException]

could not find driver

我可以运行该应用程序,但是当需要数据库连接时,出现此错误


PDOException in Connector.php line 55:

could not find driver

in Connector.php line 55

at PDO->__construct('mysql:host=localhost;dbname=mydb', 'root', '', array('0', '2', '0', false, false)) in Connector.php line 55

at Connector->createConnection('mysql:host=localhost;dbname=mydb', array('driver' => 'mysql', 'host' => 'localhost', 'database' => 'mydb', 'username' => 'root', 'password' => '', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'name' => 'mysql'), array('0', '2', '0', false, false)) in MySqlConnector.php line 22

如何解决?


蝴蝶刀刀
浏览 735回答 3
3回答

千巷猫影

这将取决于您的php版本。检查它是否正在运行:php -version现在,根据您当前的版本,运行:sudo apt-get install php7.2-mysql
打开App,查看更多内容
随时随地看视频慕课网APP