adjaf
7 months ago

Artisan custom console command gets DB Access Denied

Posted 7 months ago by adjaf

Hello, we are deploying Laravel as an API in AWS with MySQL. Everything is working fine except for the custom commands. We need to schedule two of them, the schedule is working fine, but the commands are not.

Both commands make a DB call, one is a DB::statement, and the other makes a DB::table.., however we're getting this error:

SQLSTATE[HY000] [2002] Connection refused

We tried running the commands with php artisan command:command_name, also with sudo and we got the same error What could it be? The job in crontab looks like this:

* * * * * root /usr/bin/php /var/app/current/artisan schedule:run 1>> /dev/null 2>&1

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