Laravel 5.8 PHP Artisan迁移引发错误:Illuminate \ Database \ QueryException

时间:2019-09-19 19:30:17

标签: php laravel laravel-5.8 artisan-migrate

我正在使用:

  • php 7.2
  • laravel 5.8
  • ubuntu 19

php artisan迁移引发此错误:

**Illuminate\Database\QueryException  : could not find driver (SQL: select * from information_schema.tables where table_schema = laraveldb and table_name = migrations and table_type = 'BASE TABLE')**

1. PDOException::("could not find driver")
  /home/amar/sandbox/l5/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70

2. PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=laravel", "root", "localhost", [])
  /home/amar/sandbox/l5/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70

2 个答案:

答案 0 :(得分:1)

extension=pdo_mysql.so文件中添加php.ini,并确保在对server文件进行更改后重新启动php.ini,否则可能不会反映出更改。您也可以在此链接中查看许多方法-click-here

答案 1 :(得分:0)

  1. 删除供应商文件夹,然后使用composer install重新安装
  2. 更新/安装您的php扩展名(php-mysql,php-mbstring,php-pdo,php-dom)

以上两个步骤解决了我的问题。