I’m not a PHP guy, but it looks like the driver for mySQL isn’t installed. Are you using PHP Storm? If so, check this out: MySQL | PhpStorm Documentation
I use IntelliJ for Java and Webstorm for JS so I know that JetBrains doesn’t include the DB drivers in their installers.
Problem was that i had to change localhost to 127.0.0.1 in $dsn line and it started working. Thanks for the answer anyway!