Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PDO exception could not find driver in laravel

I was trying to execute a migrate command in laravel 5. But it shows a PDOException error. I changed database.php file to the following:

  'mysql' => [
            'driver'    => 'mysql',
            'host'      => env('DB_HOST', 'localhost'),
            'database'  => env('DB_DATABASE', 'laravel'),
            'username'  => env('DB_USERNAME', 'root'),
            'password'  => env('DB_PASSWORD', ''),
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
            'strict'    => false,
            'engine'    => null,
        ]
like image 351
Sujal Patel Avatar asked Dec 10 '22 17:12

Sujal Patel


1 Answers

For PDOException: could not find driver for MySQL, and if it is Debian based OS,

sudo apt-get -y install php5-mysql

For more information read this post PDO Exception

like image 60
Md Rashedul Hoque Bhuiyan Avatar answered Jan 01 '23 21:01

Md Rashedul Hoque Bhuiyan