【发布时间】:2019-08-29 15:40:32
【问题描述】:
我正在使用 PHP 7.1、MySQL 5.7 和 Laravel 5.7.12。在 Mac 上。
我是 Laravel 的新手。我正在远程服务器(Cloudways 服务器)上构建我的应用程序。我知道大多数人在本地构建他们的项目,然后将他们的应用程序部署到远程服务器上,但我只是在实时远程服务器上构建我的应用程序并且我正在使用 SFTP。
我已配置我的 .env 文件以反映我的服务器的连接详细信息。
当我尝试运行 php artisan migrate 时出现此错误:
Illuminate\Database\QueryException : SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = ********* and table_name = migrations)
at /Users/newadmin/Documents/Sites/Quipper/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 PDOException::("SQLSTATE[HY000] [2002] No such file or directory")
/Users/newadmin/Documents/Sites/Quipper/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70
2 PDO::__construct("mysql:host=localhost;dbname=*********", "*********", "**********", [])
/Users/newadmin/Documents/Sites/Quipper/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70
上面我把 ********** 放在了我的数据库名称、用户名和密码所在的位置,我想只是出于安全原因。
我认为在第二个异常跟踪中值得注意的是它显示“mysql:host=localhost;”,当我在我的 .env 文件中输入我的 DB_HOST 地址时,它是一个远程服务器地址。所以它不应该说 localhost。这似乎是问题的一部分?
任何帮助将不胜感激!
我已经尝试在终端中运行:
php 工匠缓存:清除 php工匠配置:缓存
那没有用。
【问题讨论】:
标签: laravel