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

monstajamss's avatar

"php artisan migrate" gives error

I am trying to run php artisan migrate after installing xampp and laravel on my ubuntu 20.4 on my desktop and i get this error

   Illuminate\Database\QueryException 

  could not find driver (SQL: select * from information_schema.tables where table_schema = estate and table_name = migrations and table_type = 'BASE TABLE')

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:671
    667|         // If an exception occurs when attempting to run a query, we'll format the error
    668|         // message to include the bindings with SQL, which will make this exception a
    669|         // lot more helpful to the developer instead of just the database's errors.
    670|         catch (Exception $e) {
  > 671|             throw new QueryException(
    672|                 $query, $this->prepareBindings($bindings), $e
    673|             );
    674|         }
    675| 

      +36 vendor frames 
  37  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()

Please what is the solution?

0 likes
7 replies
codebullet's avatar

Hi not sure, maybe you can check database connection,

Check with tinker

php artisan tinker

// then 

DB::connection()->getPdo();

If you can't connect then you should check if you have a database installed or driver

Tray2's avatar

Make sure that the php<your version of php>-mysql is installed.

monstajamss's avatar

@codebullet i got this Doctrine/DBAL/Driver/PDOException with message 'could not find driver' how can i sent up laravel on my ubuntu desktop?

andris-briedis's avatar

I had a similar problem. Only it was using "ddev". It turned out that mysql responds to a completely different IP instead of 127.0.0.1 or locahost.

  1. console: ddev ssh

  2. Login to mysql: mysql -y USERNAME -p

  3. Runs this "SELECT SUBSTRING_INDEX(USER(), '@', -1) AS ip, @@hostname as hostname, @@port as port, DATABASE() as current_database;" It displays a table with data. The IP may not be the one to connect to. Must take is hostname.

  4. ping "hostname" from the previous table. And then try to put the obtained IP in the .env file. Or "hostname". It also fits.

Now connection works.

Please or to participate in this conversation.