Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vandan's avatar
Level 13

php artisan migrate not working

i install unbutu 18.04 when i try to php artisan migrate then error like

Illuminate\Database\QueryException  : could not find driver (SQL: select * from information_schema.tables where table_schema = pg_management and table_name = migrations)

at      /opt/lampp/htdocs/pg_final/pgmanagment/vendor/laravel/framework/src/Illuminate/Database/Connection.ph   p:665
    661|         // If an exception occurs when attempting to run a query, we'll format the error
    662|         // message to include the bindings with SQL, which will make this exception a
    663|         // lot more helpful to the developer instead of just the database's errors.
    664|         catch (Exception $e) {
> 665|             throw new QueryException(
    666|                 $query, $this->prepareBindings($bindings), $e
    667|             );
    668|         }
669| 

Exception trace:

1 PDOException::("could not find driver") /opt/lampp/htdocs/pg_final/pgmanagment/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70

2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=pg_management", "root", "", []) /opt/lampp/htdocs/pg_final/pgmanagment/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70

Please use the argument -v to see more details.

i also change in php.ini file

extension=php_pdo_mysql.dll add extension=pdo_mysql.so

after restart apache

but same error please help me out

0 likes
5 replies
Sinnbeck's avatar

Create a file called phpinfo.php in public and put the following inside it

<?php
phpinfo();

Now call it in a browser and search for PDO. Can you find it?

1 like
vandan's avatar
Level 13

@sinnbeck ok i added but when i try to install PDO error like -> sudo phpenmod pdo_mysql

WARNING: Module pdo_mysql ini file doesn't exist under /etc/php/7.3/mods-available WARNING: Module pdo_mysql ini file doesn't exist under /etc/php/7.3/mods-available

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

Try running this from the terminal first

sudo apt-get install php7.3-mysql
1 like
vandan's avatar
Level 13

@sinnbeck its amazing working for me thank you actaully i try to sudo apt-get install php7.0-mysql

i did not notice my php version is 7.3 so thank you sir @sinnbeck

Sam T.'s avatar

@sinnbeck I am on Ubuntu18.04 and I ran the sudo command you have above but artisan migrate is showing that I am missing the driver. Any advice?

Please or to participate in this conversation.