简体   繁体   English

SQLSTATE[HY000] [2002] 连接尝试失败.. - 尝试从本地连接到远程服务器时

[英]SQLSTATE[HY000] [2002] A connection attempt failed.. - When attempting to connect from Local to remote server

env file: .env 文件:

APP_ENV=local
APP_DEBUG=true
APP_KEY= ...........

DB_HOST=srv3.linuxisrael.co.il
DB_DATABASE= name_of_my_database
DB_USERNAME=moti_winkler
DB_PASSWORD=1234567890

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

Routes.php :路线.php :

use App\User;

Route::get('/', function(){
    User::create(['first_name' => 'moti']);
    return view('welcome');
});

The error i get :我得到的错误:

PDOException in Connector.php line 55: Connector.php 第 55 行中的PDOException

SQLSTATE[HY000] [2002] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. SQLSTATE[HY000] [2002] 连接尝试失败,因为连接方在一段时间后没有正确响应,或者由于连接的主机没有响应而建立的连接失败。

My problem is that:我的问题是:

I'm trying to connect from my computer - to my remote MySQL server我正在尝试从我的计算机连接到我的远程 MySQL 服务器

And I don't understand why it doesn't work ?我不明白为什么它不起作用?

What should I do to connect ?我应该怎么做才能连接?

What am I missing ?我错过了什么?

I am using Laravel 5.1我正在使用 Laravel 5.1

Hardly a surprise.难怪。 The mysql socket is rarely if ever left open for connections from the public facing interface. mysql 套接字很少为来自面向公众的接口的连接打开。 usually mysql port (3306) can only be accessed from the private network interface.通常mysql端口(3306)只能从私有网络接口访问。

Even if the socket was open, there are so many things that that go wrong including firewalls getting in the way and simple timeouts.即使套接字是打开的,也会出现很多问题,包括防火墙阻碍和简单的超时。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 mysqli_connect(): (HY000/2002): 与远程服务器的连接尝试失败 - mysqli_connect(): (HY000/2002): A connection attempt failed to the remote server 远程服务器SQLSTATE [HY000] [2002]连接超时 - Remote Server SQLSTATE[HY000] [2002] Connection timed out PHP 连接失败:SQLSTATE[HY000] [2002] 连接被拒绝 - PHP Connection failed: SQLSTATE[HY000] [2002] Connection refused 远程 MySQL 连接错误 SQLSTATE[HY000] [2002] - Remote MySQL Connection Error SQLSTATE[HY000] [2002] SQLSTATE [HY000] [2002]尝试将数据写入数据库时​​,与Laravel的连接被拒绝 - SQLSTATE[HY000] [2002] Connection refused with Laravel when attempting to write data to the database 连接失败:SQLSTATE[HY000] [2002] 没有这样的文件或目录 - Connection failed: SQLSTATE[HY000] [2002] No such file or directory Symfony SQLSTATE [HY000] [2002]连接被1and1服务器拒绝 - Symfony SQLSTATE[HY000] [2002] Connection refused with 1and1 server 尝试连接到Google Cloud SQL时出现消息“ SQLSTATE [HY000] [2002]连接超时”的PDOException - PDOException' with message 'SQLSTATE[HY000] [2002] Connection timed out' when trying to connect to google cloud sql SQLSTATE [HY000] [2002]尝试将连接Laravel数据库添加到Heroku时,连接被拒绝 - SQLSTATE[HY000] [2002] Connection refused when trying to add connect laravel database to Heroku SQLSTATE[HY000] [2002] 连接尝试失败,因为连接方在一段时间后没有正确响应, - SQLSTATE[HY000] [2002] A connection attempt failed because the connected party did not properly respond after a period of time,
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM