0

I am trying to migrate and already installed Xampp and also already uncomment the ";extension=php_pdo_mysql.dll" and ";extension=pdo_mysql" in the php.ini file, and still getting that error:

Illuminate\Database\QueryException

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

PDOException::("could not find driver")

Any ideas? Thank you!

brombeer
  • 8,716
  • 5
  • 21
  • 27
ChAng
  • 1

1 Answers1

0

Maybe, you don't set correct db states at .env.

Check your .env params that you want to connect your database.

for example, table_type = 'BASE TABLE' seems to be wrong?

first, check your php.ini is correct like

# Windows
extension=php_pdo_mysql.dll

# Linux
extension=php_pdo_mysql.so

Is that uncommented ? if you have ;,remove that.

and you need to restart your xampp after fixing that php.ini. do /etc/init.d/httpd restart

also your laravel env may be wrong ... so fix .env like:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE= your database name
DB_USERNAME= your database user name
DB_PASSWORD= your database password

and you should check your database config like:

/config/database.php

'mysql' => [
    'driver' => 'mysql',
    'url' => env('DATABASE_URL'),
    'host' => env('DB_HOST', '127.0.0.1'),
    'port' => env('DB_PORT', '3306'),
    'database' => env('DB_DATABASE', 'your database name'),
    'username' => env('DB_USERNAME', 'your database user name'),
    'password' => env('DB_PASSWORD', 'your database password'),
    'unix_socket' => env('DB_SOCKET', ''),
    'charset' => 'utf8mb4',
    'collation' => 'utf8mb4_unicode_ci',
    'prefix' => '',
    'prefix_indexes' => true,
    'strict' => true,
    'engine' => null,
    'options' => extension_loaded('pdo_mysql') ? array_filter([
        PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
    ]) : [],
],

takuma bo
  • 194
  • 2
  • 10
  • Thank you, sir, for answering and the suggestions, but all of that is I already done and the error message still the same. Is there any solution for this? – ChAng Dec 08 '22 at 05:43
  • actually mysql is correct running on xampp? are there any errors? – takuma bo Dec 08 '22 at 06:36
  • for example, quick check way is like this: 1. set on your index.php 2. find ```PDO support```,and driver value 3. if in that value is no value or nothing, it is not correct running xampp mysql 4. if in that value is mysql or pdf_mysql, it is correct running – takuma bo Dec 08 '22 at 06:39
  • if you check all, next you need to find your running server ・linux server do ```yum -y install php-pdo yum -y install php-mysql``` and restart server ・windows server fix your php.ini like ``` ;extension=pdo_mysql  → extension=pdo_mysql ``` and restart apache server – takuma bo Dec 08 '22 at 06:47
  • if you do all, can you check your status under following code? ``` getMessage() . "\n"; } ``` – takuma bo Dec 08 '22 at 06:49