HessianMad
HessianMad

Reputation: 567

Can't connect to mysql database with Doctrine in Symfony

I'm trying to connect my Symfony 4 application with my mysql database but I'm having some issues.

I have installed doctrine with these commands line: composer require symfony/orm-pack and composer require symfony/maker-bundle --dev. After that I have configured the .env to connect to my localhost mysql database with the correct user and password.

Then I create my entity class USER and I tried to migrate that entity to the database with the command line php bin/console make:migration but this error appear on my terminal:

In AbstractMySQLDriver.php line 106: An exception occurred in driver: could not find driver

In PDOConnection.php line 31: could not find driver

In PDOConnection.php line 27: could not find driver

Every step I followed is from the symfony 4(https://symfony.com/doc/current/doctrine.html) documentation. Any idea what am I doing wrong?

Thanks.

Upvotes: 2

Views: 2553

Answers (1)

badger0053
badger0053

Reputation: 1209

You need to make sure your driver is installed. For Ubuntu 16 and PHP7 use:

sudo apt-get install php-mysql

Upvotes: 2

Related Questions