0
我試圖用我的Laravel項目附上phpMyAdmin的在我的XAMPP服務器,我失敗了,我每次做:發生連接phpMyAdmin的在XAMPP與Laravel項目
php artisan migrate
此錯誤:
[PDOException]
SQLSTATE[HY000] [2002] No such file or directory
這是我
.env
文件:DB_CONNECTION=mysql DB_HOST=localhost DB_PORT=3306 DB_DATABASE=laravel DB_USERNAME=root DB_PASSWORD=''
這是我
database.php
文件:'mysql' => [ 'driver' => 'mysql', 'host' => 'localhost', 'port' => env('DB_PORT', '3306'), 'database' => 'laravel', 'username' => 'root', 'password' => '', 'unix_socket' => '/opt/lampp/var/mysql/mysql.sock', 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', 'strict' => true, 'engine' => null, ],
在您的php.ini文件中更改'mysqli.default_host'指向路徑'/ tmp/mysql.sock' –