murilo
246
4
Servers

I cant connect Mysql .env Production

Posted 3 months ago by murilo

Hello , Please . some one can help me ? I am trying to deploy a website in this server - vultr.com .

Well , I had donne everthing correctly , but It is not connecting to database . I using Nginx / Laravel 5.8 / PHP 7.2

this is my .env

APP_NAME=Laravel
APP_ENV=production
APP_KEY=base64:gyo6oWaubavzqyQNRfH9TEvn0Pbnmfg2345Slfo=
APP_DEBUG=false
APP_URL=http://144.202.33.87

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=post_test
DB_USERNAME=m_user1
DB_PASSWORD=hHHkd123


this is the log error -

    [2019-05-03 21:37:24] production.ERROR: SQLSTATE[HY000] [1045] Access denied for user 'm_user1'@'localhost' (using password: YES) (SQL: select count(*) as aggregate from `posts`) {"exception":"[object] (Illuminate\Database\QueryException(code: 1045): SQLSTATE[HY000] [$
[stacktrace]

I can access this database using

     mysql -u m_user1 -p 'post_test'

and after , type my password . I access successfuly .

my database is like this -

+----------------------+
| Tables_in_post_test  |
+----------------------+
| post_categories      |
| posts                |
| migrations           |
+----------------------+
3 rows in set (0.00 sec)

But I cant connect , with laravel . maybe my .env is rong . do I use APP_ENV=production ?

I alredy tried -

php artisan config:cache
php artisan dump-autoload
php artisan config:cache
php artisan route:clear

Please sign in or create an account to participate in this conversation.