简体   繁体   English

将XAMPP中的phpMyAdmin与Laravel项目连接

[英]Connecting phpMyAdmin in XAMPP with Laravel project

i tried to attach phpMyAdmin in my XAMPP server with my Laravel project and i failed , every time i make : 我尝试将Laravel项目的phpMyAdmin附加到我的XAMPP服务器中,但每次执行以下操作都失败:

php artisan migrate

This error occurs: 发生此错误:

[PDOException]                                    
SQLSTATE[HY000] [2002] No such file or directory
  • This is my .env file : 这是我的.env文件:

     DB_CONNECTION=mysql DB_HOST=localhost DB_PORT=3306 DB_DATABASE=laravel DB_USERNAME=root DB_PASSWORD='' 
  • This is my database.php file : 这是我的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, ], 

The error is because you are trying to connect to MYSQL with a socket file which cannot be found given the path provided. 该错误是因为您尝试使用套接字文件连接到MYSQL,而套接字文件在给定的路径下找不到。 Change the path to the mysql.sock file 将路径更改为mysql.sock文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM