MacieG's avatar

[PDOException] could not find driver - Laravel - WAMP

Hi i want to migrate from sqlite to mysql, i install WAMP server, configure this and work fine, but...

 [PDOException]
  could not find driver

i see this error when i want

php artisan migrate

Select PHP: 5.6.25, but on 7.0.10 dont work too

my php.ini from wamp

;extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_odbc.dll
extension=php_pdo_pgsql.dll
extension=pgsql.so
extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll

my dtabase.php

 'default' => env('DB_CONNECTION', 'mysql'),


    'connections' => [

        'sqlite' => [
            'driver'   => 'sqlite',
            'database' => database_path('database.sqlite'),
            'prefix'   => '',
        ],

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

and my .env

DB_HOST=127.0.0.1
DB_DATABASE=mwebsite
DB_USERNAME=root
DB_PASSWORD=
0 likes
4 replies
Hujjat's avatar

What's the value of your DB_CONNECTION in .env file ?

MacieG's avatar

I dont have DB_CONNECTION in .env

on localhost work fine but dont find table users

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mwebsite.users' doesn't exist (SQL: select * from `users` where `users`.`id` = 1 limit 1)

because i cant migrate

karan_5.4's avatar

I'm facing the same issue. I'm running a wamp server and Laravel 5.4 the .env file already has the following :

DB_CONNECTION= mysql.

->still, when I try to perform a migration using cmd, I get the error:

"could not find driver (SQL: select*from infromation_schema.tables where table_schema= laravel_test and table_name=migrations) [PDOException] could not find driver ".

-> in the php extensions menu, under title No'extension=' it reads "php_pdo_mysql"

Please provide a step by step solution since I'm new to both php and laravel.

Please or to participate in this conversation.