Artisan migrate error: Illuminate\Database\QueryException
I am trying to migrate and a开发者_如何学Clready 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!
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'),
]) : [],
],
精彩评论