skip to Main Content

This is the error when i try to run php artisan migrate:

     IlluminateDatabaseQueryException 

  could not find driver (Connection: mysql, SQL: select exists (select 1 from information_schema.tables where table_schema = 'fitnessapp' and table_name = 'migrations' and table_type in ('BASE TABLE', 'SYSTEM VERSIONED')) as `exists`)

  at vendorlaravelframeworksrcIlluminateDatabaseConnection.php:825
    821▕                     $this->getName(), $query, $this->prepareBindings($bindings), $e
    822▕                 );
    823▕             }
    824▕
  ➜ 825▕             throw new QueryException(
    826▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    827▕             );
    828▕         }
    829▕     }

  1   vendorlaravelframeworksrcIlluminateDatabaseConnectorsConnector.php:66
      PDOException::("could not find driver")

  2   vendorlaravelframeworksrcIlluminateDatabaseConnectorsConnector.php:66
      PDO::__construct()

I have the right drivers enabled like so:
extension=pdo_mysql

and I have configured the .env file correctly to match the data from the database that i created in phpmyadmin page.

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=fitnessapp
DB_USERNAME=root
DB_PASSWORD=

Do i need to install something else(i have tried recreating the laravel project but i get the same error) how to fix this error?

2

Answers


  1. You need to ensure that you have the PHP Extension "PDO" installed. Laravel is not providing your PHP installation. I assume that you are using Windows here is how to install it: How do I install PDO drivers for PHP on Windows?

    Login or Signup to reply.
  2. Inside of ur localhosting configs files find PHP folder and config php.ini file.
    To find your ini file follow this link

    after that find ;extension=pdo_mysql and change like this, remove semicolon from strarting

    ;extension=pdo_mysql
    

    TO

    extension=pdo_mysql
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search