[英]Error in migration of table in Laravel, though there is no problem in connecting with database
當我嘗試使用命令php artisan migrate --path="2022_04_17_161039_create_cruds_table.php"
中的表時,出現此錯誤 -
Illuminate\Database\QueryException
could not find driver (SQL: select * from information_schema.tables where table_schema = crud and table_name = migrations and table_type = 'BASE TABLE')
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:745
741▕ // If an exception occurs when attempting to run a query, we'll format the error
742▕ // message to include the bindings with SQL, which will make this exception a
743▕ // lot more helpful to the developer instead of just the database's errors.
744▕ catch (Exception $e) {
➜ 745▕ throw new QueryException(
746▕ $query, $this->prepareBindings($bindings), $e
747▕ );
748▕ }
749▕ }
+33 vendor frames
34 artisan:37
Illuminate\Foundation\Console\Kernel::handle()
但是當我嘗試使用php artisan db mysql
連接數據庫時,它工作得很好。
請幫助我,如果連接數據庫沒有問題,那么為什么遷移命令不起作用。
另外,我啟用了pdo_mysql
驅動程序。
PHP 需要php-mysql
擴展才能與 MySQL 通信,請確保在您的系統中安裝並擁有此擴展,如果您之前安裝過它並且您有多個 PHP 版本,請確保為您需要的 PHP 版本安裝此擴展
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.