-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)
3

2 Answers 2

1

composer update

composer require doctrine/dbal

Sign up to request clarification or add additional context in comments.

Comments

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.