0

I was searching solution of this problem but i did not find exactly the same which I have. This is all error message:

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

at /mnt/c/xampp/htdocs/blog/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 this exception a 662| // lot more helpful to the developer instead of just the database'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") /mnt/c/xampp/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70

2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=forge", "forge", "", []) /mnt/c/xampp/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70

Please use the argument -v to see more details.

I tried make command sudo apt-get install php7.0-pgsqland other from this topic Laravel: Error [PDOException]: Could not Find Driver in PostgreSQL and still does not work.

roberto23
  • 11
  • 1
  • 3

1 Answers1

0

You need to install pdo and mysql driver

sudo apt-get install php{V}-mysql


sudo apt-get install pdo-mysql

replace v with your php version. If your using PostgreSQL, please make sure to change connection in config/database.php or in the .env file

Jagadesha NH
  • 2,529
  • 2
  • 23
  • 41
  • I did this and I received for php5-mysql Reading package lists... Done Building dependency tree Reading state information... Done Package php5-mysql is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'php5-mysql' has no installation candidate and for pdo-mysql Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package pdo-mysql – roberto23 Dec 16 '18 at 16:49
  • sudo apt-get install php-mysql – Jagadesha NH Dec 16 '18 at 16:51
  • The same I got message Reading package lists... Done php-mysql 0 upgraded, 1 newly installed, 0 to remove and 207 not upgraded. Need to get 5,958 B of archives. After this operation, 12.3 kB of additional disk space will be used. Err:1 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 php-mysql all 2:7.2+68+ubuntu16.04.1+deb.sury.org+1 Bad header line Bad header data E: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/pool/main/p/php-defaults/php-mysql_7.2+68+ubuntu16.04.1+deb.sury.org+1_all.deb Bad header line Bad header data – roberto23 Dec 16 '18 at 16:54
  • which version of php are you using? – Jagadesha NH Dec 16 '18 at 16:56
  • PHP 7.1.25-1+ubuntu16.04.1+deb.sury.org+1 – roberto23 Dec 16 '18 at 16:58
  • sudo apt-get install php7.1-mysql – Jagadesha NH Dec 16 '18 at 17:02
  • https://stackoverflow.com/questions/32728860/php-7-rc3-how-to-install-missing-mysql-pdo – Jagadesha NH Dec 16 '18 at 17:03
  • Finally migration created successfully but I still got message – roberto23 Dec 16 '18 at 17:07
  • Exception trace: 1 PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes") /mnt/c/xampp/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Connection.php:458 2 PDOStatement::execute() /mnt/c/xampp/htdocs/blog/vendor/laravel/framework/src/Illuminate/Database/Connection.php:458 – roberto23 Dec 16 '18 at 17:07
  • in AppServiceProvider boot function add this line Schema::defaultStringLength(191); – Jagadesha NH Dec 16 '18 at 17:10
  • In AppServiceProvider.php line 16: Class 'App\Providers\Schema' not found – roberto23 Dec 16 '18 at 17:21
  • Ok I added use Illuminate\Support\Facades\Schema; but why I still mesage like in first post... – roberto23 Dec 16 '18 at 17:27