[SOLVED] php artisan migrate throwing [PDO Exception] Could not find driver – Using Laravel


I have a bad experience while installing laravel. However, I was able to do so and move to the next level. I used generators and created my migrations.
But when I type the last command

php artisan migrate

It’s throwing a PDOException – could not find driver.

       'mysql' => array(
            'driver'    => 'mysql',
            'host'      => 'localhost',
            'unix_socket'   => '/Applications/MAMP/tmp/mysql/mysql.sock',
            'database'  => 'database',
            'username'  => 'root',
            'password'  => '',
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',

That’s my configuration in config/database.php.

I tried searching on stackoverflow and laravel forums and people suggest that it’s PDO problem and not artisan’s or php’s – I followed those suggestions like adding


in php.ini

No positive result. It always says [PDOException]could not find driver.

Can someone please help resolving this.

Environment that I am using: Mac, laravel 4, MAMP PRO with php 5.4.4


You can use

sudo apt-get install php7-mysql


sudo apt-get install php5-mysql


sudo apt-get install php-mysql

This worked for me.

Answered By – narendro

Answer Checked By – Marie Seifert (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *