7

As I run php artisan migrate command it output

In Connection.php line 664:
could not find driver (SQL: select * from information_schema.tables where t able_schema = employee and table_name = migrations)
In PDOConnection.php line 47: could not find driver In PDOConnection.php line 43: could not find driver

and also i have pdo enabled for mysql, pgsql, sqlite im using ubuntu 16 and PHP Version 7.2.8 and laravel 5.5

Lovepreet Singh
  • 4,792
  • 1
  • 18
  • 36
Ankit Bihani
  • 105
  • 1
  • 1
  • 4
  • Use `php -m` command to check whether `mysql, pgsql, sqlite` modules are installed. – Lovepreet Singh Aug 23 '18 at 09:51
  • Try unninstalling the PDO and installing it again using: `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: `` in the indexed/public folder of your server. – Rafael Aug 23 '18 at 09:51
  • @Rafael i created it and it shows pdo enabled for mysql, pgsql, sqlite – Ankit Bihani Aug 23 '18 at 09:54
  • @LovepreetSingh i use your command it output a list and list does not have mysql, pgsql, sqlite – Ankit Bihani Aug 23 '18 at 09:56
  • You could also try installing the driver specifically for the php version you have, though I don't see how that could be any different than the previous command: `$ apt-get install php7.2-mysql` – Rafael Aug 23 '18 at 09:56
  • thanx @Rafael i run first command and it works for me thnx – Ankit Bihani Aug 23 '18 at 10:00
  • migration works but when i try to register on browser it shows Illuminate \ Database \ QueryException could not find driver (SQL: select count(*) as aggregate from `users` where `email` = ankit@gmail.com) – Ankit Bihani Aug 23 '18 at 10:03
  • I'm gonna add an answer with that line then. – Rafael Aug 23 '18 at 10:03

5 Answers5

13

Use php -m command to check whether mysql, pgsql, sqlite modules are installed.

If not listed then use following command to install.

apt-get install php7.2-mysql php7.2-pgsql php7.2-sqlite
Lovepreet Singh
  • 4,792
  • 1
  • 18
  • 36
11

You need to install php-mysql package. sudo apt install php-mysql will work but it will download the plugin for the latest PHP version.

If your PHP version is not the latest, then you can add version in it:

# 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
Player1
  • 2,878
  • 2
  • 26
  • 38
1

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

Arthur Caccavo
  • 98
  • 1
  • 10
0

Try unninstalling the PDO and installing it again using:

$ 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.

Rafael
  • 1,495
  • 1
  • 14
  • 25
0

try to install php-mysql with following command sudo apt-get install php-mysql and restart your server

Levon Babayan
  • 266
  • 2
  • 18