php - Laravel 6: Problem with credentials for MySQL and e-mail on production server only

700

I updated a Laravel app from 5.7 to 5.8 and finally to 6 on my local development server (Homestead). Then I uploaded the app to a production server. I had to update PHP to version 7.2 on the production server. The homepage loads just fine, but when trying to log in there's a database error.

This is from the log file:

production.ERROR: SQLSTATE[HY000] [1045] Access denied for user 'xxx'@'xxx.xx.xx.xx' (using password: YES)
(SQL: select * from `users` where `email` = [email protected] 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` = [email protected] limit 1) at 
/html/scouting/vendor/laravel/framework/src/Illuminate/Database/Connection.php:665)

Also, whenever a user logs in, an email should be sent. This isn't working, either:

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"

I wonder what exactly "Error: authentication failed: UGFzc3dvcmQ6" means (UGFzc3dvcmQ6 is a base64 representation of the string Password). Also, in both stack traces there's a mention ofLaravelCaffeineDripMiddleware.php. I am using Caffeine, which works flawlessly in Homestead (edit: After disabling Caffeine, this is gone from the stack traces).

Apart from that, I have no idea what the problem might be. I can still connect to MySQL using Sequel Pro and.env has not been modified.

374

Answer

Solution:

To answer my own question: I had hashes ('#') in both DB and e-mail passwords. These indicate the beginning of a comment in Laravel 5.8 and 6. Wrapping these passwords in quotes solved my issue.

https://laravel.com/docs/5.8/upgrade#environment-variable-parsing

People are also looking for solutions to the problem: php - Having trouble understanding why my Closure wasn't working

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.