【发布时间】:2018-10-11 16:20:17
【问题描述】:
当我在 Windows 上使用 git 终端并尝试运行“php artisan migrate”来迁移我的表时,我收到此错误:
1 PDOException::("找不到驱动程序")
但是当我通过 ssh 登录到我的虚拟框“vagrant ssh”时,当我导航到站点文件夹并运行“php artisan migrate”时,它工作得非常好。
发生这种情况的任何原因?我该如何解决?
完整的错误信息:
$ php artisan migrate
Illuminate\Database\QueryException : could not find driver (SQL: select * fr
om information_schema.tables where table_schema = aff and table_name = migration
s)
at C:\Users\jarro\Documents\sites\aff\vendor\laravel\framework\src\Illuminate\
Database\Connection.php:664
660| // If an exception occurs when attempting to run a query, we'll
format the error
661| // message to include the bindings with SQL, which will make th
is exception a
662| // lot more helpful to the developer instead of just the databa
se's errors.
663| catch (Exception $e) {
> 664| throw new QueryException(
665| $query, $this->prepareBindings($bindings), $e
666| );
667| }
668|
Exception trace:
1 PDOException::("could not find driver")
C:\Users\jarro\Documents\sites\aff\vendor\laravel\framework\src\Illuminate
\Database\Connectors\Connector.php:68
2 PDO::__construct("mysql:host=192.168.10.10;port=3306;dbname=aff", "homeste
ad", "secret", [])
C:\Users\jarro\Documents\sites\aff\vendor\laravel\framework\src\Illuminate
\Database\Connectors\Connector.php:68
Please use the argument -v to see more details.
【问题讨论】:
-
你的本地机器上是否安装了
mysql? -
你检查
php -m的pdo_mysql扩展了吗? -
@Spholt 是的,我确实安装了 Ammps。 ampps.com 它带有 MySQL。我需要卸载这个并重试吗?
-
@mim。
php -m将 PDO 作为选项之一,所以我猜它已安装! -
您能否使用异常中提供的凭据通过命令行连接到您的数据库? (
host=192.168.10.10;port=3306;dbname=aff)。你的宅基地箱在运行吗?
标签: php git laravel ssh homestead