我在本地开发服务器 (Homestead) 上将 Laravel 应用程序从 5.7 更新到 5.8,最后更新到 6。然后我将应用程序上传到生产服务器。我必须在生产服务器上将 PHP 更新到版本 7.2。主页加载得很好,但尝试登录时出现数据库错误。
这是来自日志文件:
production.ERROR: SQLSTATE[HY000] [1045] Access denied for user 'xxx'@'xxx.xx.xx.xx' (using password: YES)
(SQL: select * from `users` where `email` = xxx@example.org.de limit 1)
{"exception":"[object] (Illuminate\\Database\\QueryException(code: 1045): SQLSTATE[HY000]
[1045] Access denied for user 'xxx'@'xxx.xx.xx.xx' (using password: YES) (SQL: select * from
`users` where `email` = xxx@example.org limit 1) at
/html/scouting/vendor/laravel/framework/src/Illuminate/Database/Connection.php:665)
此外,每当用户登录时,都应该发送一封电子邮件。这也不起作用:
Failed to authenticate on SMTP server with username "xxx" using 2 possible authenticators.
Authenticator LOGIN returned Expected response code 235 but got code "535", with message "535 5.7.8
Error: authentication failed: UGFzc3dvcmQ6".
Authenticator PLAIN returned Expected response code 235 but got code "535", with message "535 5.7.8
Error: authentication failed: UGFzc3dvcmQ6"
我想知道“错误:身份验证失败:UGFzc3dvcmQ6”到底是什么意思(UGFzc3dvcmQ6是字符串密码的base64表示)。此外,在两个堆栈跟踪中都提到了 LaravelCaffeineDripMiddleware.php
。我正在使用 Caffeine,它在 Homestead 中完美运行(编辑:禁用 Caffeine 后,它会从堆栈跟踪中消失)。
除此之外,我不知道问题是什么。我仍然可以使用 Sequel Pro 连接到 MySQL,并且 .env
尚未修改。
最佳答案
回答我自己的问题:我在数据库和电子邮件密码中都有哈希值(“#”)。这些表示 Laravel 5.8 和 6 中评论的开始。将这些密码用引号引起来解决了我的问题。
https://laravel.com/docs/5.8/upgrade#environment-variable-parsing
关于php - 拉拉维尔 6 : Problem with credentials for MySQL and e-mail on production server only,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59410379/