How to fix ' SQLSTATE[HY000] [2002] Connection refused' error. I put the good informations but the message error still ;
In local it's work but not in production
What do you mean by Good Information?
I put the good informations
You better show your connection code.
right values
DB_CONNECTION=mysql
DB_HOST=mydomaine.mysql.db
DB_PORT=3306
DB_DATABASE=mydatabase
DB_USERNAME=mydbname
DB_PASSWORD=secret
@tisuchi
@omarsow94
Yes, that's the default value. What you need to change there is-
DB_CONNECTION=mysql
DB_HOST=mydomaine.mysql.db
DB_PORT=3306
DB_DATABASE=nameOfYourDatabase
DB_USERNAME=databaseUserName
DB_PASSWORD=databasePassword
Normally DB_HOST is localhost if it is in the same hosting.
Yes i know , i change all values for the truth.
In local , it's work but in production not @tisuchi
The server where you want to access database is not accessible it may be offline.Make sure your database access info all are correct.
Try below command and let me know if you're able to connect the database.
mysql -u {username} -p{password} -h {remote server ip} {DB name}
Note: Replace your database credential
@omarsow94
As long as it works in the Local environment, it might be problematic in your database api permission. Make sure you have the right permission to access the DB that @Ishatanjeeb mentioned in his comment.
Hi,
I m facing same error, how to give permission from database
Please sign in or create an account to participate in this conversation.