2
votes

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.

1
Have you looked at this thread? may be the same issue stackoverflow.com/questions/2852748/… - badger0053
Not exactly same issue, but reading in the comments I found my solution: sudo apt-get install php-mysql. Thanks @badger0053 - HessianMad

1 Answers

2
votes

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

sudo apt-get install php-mysql