could not find driver

[Doctrine\DBAL\Driver\PDOException] could not find driver

这是执行

php artisan migrate

后报的错!

一种是 没有配置 数据库的链接方式!

config/database.php 里有多种链接方式!

可以在 .env 里设置你需要链接的数据库驱动

默认是mysql

如果这里设置没有问题!

看看你环境mysql是否开启或者是否安装!!!!

我的本地安装过了!

但是我用 mysql 提示我要安装!

The program 'mysql' can be found in the following packages:
 * mysql-client-core-5.7
 * mariadb-client-core-10.0
Try: apt install <selected package>

我明明已经安装!

那么,就是mysql没有设置环境变量!

vim /etc/profile

跳到最后一行!

加上

export PATH=/usr/local/nginx/sbin:/usr/local/php/bin:/usr/local/mysql/bin:$PATH

上面是加了nginx,php,mysql三者的!看着改!

然后保存后

source /etc/profile

在回去执行mysql 就有了!


欢迎转载,但请附上原文地址哦,尊重原创,谢谢大家 本文地址: http://www.iphpt.com/detail/116/

当你能力不能满足你的野心的时候,你就该沉下心来学习