我是Laravel和myphpadmin的新手所以我假设在将参数输入我的env文件时犯了一个愚蠢的错误。此外,请记住,我正在使用MAMP附带的全新myphpadmin副本(我根本没有更改用户名或密码)。
这是我的错误:
Illuminate\Database\QueryException : SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = mysql an
d table_name = migrations)
at
/Users/christian/Desktop/lsapp/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| }
Exception trace:
1 PDOException::("SQLSTATE[HY000] [2002] No such file or directory")
/Users/christian/Desktop/lsapp/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
2 PDO::__construct("mysql:host=localhost;port=8080;dbname=mysql", "root", "", [])
/Users/christian/Desktop/lsapp/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
这是我的环境文件:
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=8080
DB_DATABASE=lsapp
DB_USERNAME=root
DB_PASSWORD=
答案 0 :(得分:0)
在您的env文件中,尝试更改为:
DB_HOST=127.0.0.1
DB_PORT=3306
你还确定mysql在8080上运行吗?我的通常是3306
答案 1 :(得分:0)
8080是您的Apache端口,尽管它出现在您的PHPMyAdmin的网址中,但它不是您需要放入.env的值
您的MAMP安装应该提到您需要用于DB_PORT值的单独MySQL端口。