Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLSTATE[HY000] [2002] Establishing tcp connections on remote port 3306 has been disabled for security reasons

I am using laravel 5 to implement api in subdomain for example: api.domain.com

I copied the laravel from local to sharing host. In public_html/api folder.

In local eveything works fine, but in server I got this error:

PDOException in Connector.php line 55: SQLSTATE[HY000] [2002] Establishing tcp connections on remote port 3306 has been disabled for security reasons.

When I try to connect database by laravel 5.

What should I do?

like image 367
Amirhossein Validabadi Avatar asked Aug 18 '16 14:08

Amirhossein Validabadi


1 Answers

Use localhost instead of 127.0.0.1 in your .env file for DB_HOST variable.

like image 127
Alireza Sadeghian Avatar answered Oct 09 '22 01:10

Alireza Sadeghian