2

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.

HessianMad
  • 549
  • 7
  • 23
  • 1
    Have you looked at this thread? may be the same issue https://stackoverflow.com/questions/2852748/pdoexception-could-not-find-driver/2852997 – badger0053 Feb 02 '19 at 19:39
  • 1
    Not exactly same issue, but reading in the comments I found my solution: `sudo apt-get install php-mysql`. Thanks @badger0053 – HessianMad Feb 02 '19 at 19:44

1 Answers1

2

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

sudo apt-get install php-mysql

badger0053
  • 1,179
  • 1
  • 13
  • 19
  • 2
    @HessianMad I think its helpful for the larger community to have answer in an actual answer rather than a comment. The question/comment may be overlooked without an answer – badger0053 Feb 02 '19 at 20:03