October 21, 2024
Chicago 12, Melborne City, USA
PHP

I have a problem connecting laravel to my database


This is the error that i get:

     Illuminate\Database\QueryException 

  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 vendor\laravel\framework\src\Illuminate\Database\Connection.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   vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:66
      PDOException::("could not find driver")

  2   vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.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?



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video