-1

I'm trying to connect with PHP and MySQL through the database using Laravel doing:

php artisan migrate but I'm experiencing a common error:

"Illuminate\Database\QueryException : could not find driver"

(I'm using XAMPP to start up the server if that makes a difference)

The values I changed in database.php:

'mysql' => [
    'driver' => 'mysql',
    'host' => env('DB_HOST', '127.0.0.1'),
    'port' => env('DB_PORT', '3308'),
    'database' => env('DB_DATABASE', 'test2'),
    'username' => env('DB_USERNAME', 'root'),
    'password' => env('DB_PASSWORD', ''),
    'unix_socket' => env('DB_SOCKET', ''),
    'charset' => 'utf8mb4',
    'collation' => 'utf8mb4_unicode_ci',
    'prefix' => '',
    'prefix_indexes' => true,
    'strict' => true,
    'engine' => null,
],

I also changed the .env file:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3308
DB_DATABASE=test2
DB_USERNAME=root
DB_PASSWORD=

The things I did were:

  • See if the extension=pdo_mysql is uncommented which it was.
  • Typed in php artisan migrate:refresh
  • Restarted Xampp
  • Deleted and recreated the migration file. Also incremented the last digit of the number (taken advice from one of the answers)
  • Check the version (which is the latest)
bunbun
  • 2,595
  • 3
  • 34
  • 52
Zne
  • 1
  • Possible duplicate of [Artisan migrate could not find driver](https://stackoverflow.com/questions/46745365/artisan-migrate-could-not-find-driver) – Cory Fail Nov 30 '18 at 00:04
  • Please check in this link. [enter link description here](https://stackoverflow.com/questions/42557693/laravel-pdoexception-could-not-find-driver) – user8063037 Nov 30 '18 at 04:16
  • Possible duplicate of [Laravel: PDOException: could not find driver](https://stackoverflow.com/questions/42557693/laravel-pdoexception-could-not-find-driver) – Saurabh Mistry Nov 30 '18 at 04:43

2 Answers2

1

composer update

composer require doctrine/dbal

user8063037
  • 161
  • 1
  • 1
  • 8
0

Check to see if pro_mysql is activated on your install.

You can do this by creating a file and adding the following:

phpinfo();

Then navigate to it in your browser. If it is activated you will see it in the list.

Here is some more info:

http://php.net/manual/en/function.phpinfo.php

Hope that helps.

Josh
  • 1,316
  • 10
  • 26