我正在嘗試通過使用此命令php artisan migrate并收到此錯誤來遷移 MySQL 中的表。
Illuminate\Database\QueryException : SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = home and table_name = migrations)
at /Users/bilalshahid/Desktop/laravel/officeProject/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
660| // If an exception occurs when attempting to run a query, we'll format the error
661| // message to include the bindings with SQL, which will make this exception a
662| // lot more helpful to the developer instead of just the database's errors.
663| catch (Exception $e) {
> 664| throw new QueryException(
665| $query, $this->prepareBindings($bindings), $e
666| );
667| }
668|
Exception trace:
1 Doctrine\DBAL\Driver\PDO\Exception::("SQLSTATE[HY000] [2002] No such file or directory")
/Users/bilalshahid/Desktop/laravel/officeProject/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18
2 Doctrine\DBAL\Driver\PDO\Exception::new(Object(PDOException))
/Users/bilalshahid/Desktop/laravel/officeProject/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:44
Please use the argument -v to see more details.
我使用 Xampp 運行服務器,.env 檔案包含以下資訊:
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=home
DB_USERNAME=root
DB_PASSWORD=root
DB_STRICT=false
DB_SOCKET=
請指導我如何解決這個錯誤。
uj5u.com熱心網友回復:
首先,檢查所有遷移檔案。之后,如果問題沒有解決,則嘗試使用新的資料庫名稱。
uj5u.com熱心網友回復:
該表不存在。創建一個新的遷移并檢查表名
uj5u.com熱心網友回復:
更改DB_HOST=localhost為DB_HOST=127.0.0.1
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/380024.html
上一篇:SQL多左連接作為新列的性能
