[英]could not find driver in laravel
As I run php artisan migrate
command it output当我运行
php artisan migrate
命令它 output
In Connection.php line 664:
在 Connection.php 行 664:
could not find driver (SQL: select * from information_schema.tables where t able_schema = employee and table_name = migrations)找不到驱动程序(SQL:select * from information_schema.tables where table_schema = employee and table_name = migrations)
In PDOConnection.php line 47: could not find driver In PDOConnection.php line 43: could not find driver在 PDOConnection.php 第 47 行:找不到驱动程序 在 PDOConnection.php 第 43 行:找不到驱动程序
and also i have pdo enabled for mysql, pgsql, sqlite im using ubuntu 16 and PHP Version 7.2.8 and laravel 5.5 and also i have pdo enabled for mysql, pgsql, sqlite im using ubuntu 16 and PHP Version 7.2.8 and laravel 5.5
Use php -m
command to check whether mysql, pgsql, sqlite
modules are installed.使用
php -m
命令检查是否安装了mysql, pgsql, sqlite
模块。
If not listed then use following command to install.如果未列出,则使用以下命令进行安装。
apt-get install php7.2-mysql php7.2-pgsql php7.2-sqlite
You need to install php-mysql
package.您需要安装
php-mysql
包。 sudo apt install php-mysql
will work but it will download the plugin for the latest PHP version. sudo apt install php-mysql
将起作用,但它会下载最新 PHP 版本的插件。
If your PHP version is not the latest, then you can add version in it:如果您的 PHP 版本不是最新的,那么您可以在其中添加版本:
# PHP 7.1
sudo apt install php7.1-mysql
# PHP 7.2:
sudo apt install php7.2-mysql
# PHP 7.3
sudo apt install php7.3-mysql
# PHP 7.4
sudo apt install php7.4-mysql
# PHP 8
sudo apt install php-mysql
Try unninstalling the PDO and installing it again using:尝试卸载 PDO 并使用以下命令重新安装:
$ apt-get install php-mysql
When you install it, it should already register and enable it's own dependencies.当您安装它时,它应该已经注册并启用它自己的依赖项。
You can test if it's enabled creating a file with this content:您可以测试是否启用了使用此内容创建文件:
<?php phpinfo(); ?>
In the indexed/public folder of your server.在服务器的索引/公共文件夹中。
尝试使用以下命令安装 php-mysql sudo apt-get install php-mysql 并重新启动服务器
Have you checked if the table migrations exist on the database?您是否检查过数据库上是否存在表迁移?
You could try to run:您可以尝试运行:
php artisan migrate:install
and after that you can try your (what I think you were doing to get the error):之后你可以试试你的(我认为你正在做什么来得到错误):
php artisan migrate --seed
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.