简体   繁体   English

mysql ERROR 2003 [HY000] - 当我尝试连接到远程 mysql 时

[英]mysql ERROR 2003 [HY000] - When i'm trying to connect to remote mysql

I have mysql database in shared hosting that defined with % in "remote MySQL" in a Cpanel我在共享主机中有一个 mysql 数据库,它在Cpanel 的“远程 MySQL”中用%定义

And I type within CMD:我在 CMD 中输入:

C:\xampp\mysql\bin>mysql -u SiteName_username -p pass_of_mysql -h srv3.linuxisrael.co.il

I press ENTER我按回车

Enter password :

I press ENTER我按回车

PS - It's right to press here ENTER ? PS - 在这里按 ENTER 是正确的吗?

I do not have a password in MySQL installed on my computer我的计算机上没有安装 MySQL 的密码

And i get :我得到:

mysql error 2003 (hy000) Can't connect to MySQl server on 'srv3.linuxisrael.co.il' (10060 "Unknown error")


And in Laravel 5.1 i get this error:在 Laravel 5.1 中,我收到此错误:

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] 连接尝试失败,因为连接方在一段时间后没有正确响应,或者由于连接的主机没有响应而建立的连接失败。

it's configured so :它是这样配置的:

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=name_of_database_username
DB_PASSWORD=password_of_the_username

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');
});

How can I connect to MySQL?如何连接到 MySQL?

I want to connect through Laravel But I see that it does not work for me even when I try via the CMD我想通过 Laravel 连接但我发现即使我通过CMD尝试它也不适合我

What's the solution?解决办法是什么?

thank you very much !非常感谢 !

I have checked using following command through CMD:我已经通过 CMD 使用以下命令进行了检查:

telnet srv3.linuxisrael.co.il 3306

It is not able to connect through port 3306. So it seems there is some issue with the server side and port 3306 is not opened to the world.无法通过3306端口连接。所以服务器端似乎有问题,3306端口没有对外开放。

You can check the mysql connection using following simple PHP code snippet.您可以使用以下简单的 PHP 代码片段检查 mysql 连接。

$conn = mysql_connect("$dbhost", "$dbuser", "$dbpass") or die(mysql_error());
mysql_select_db($dbname, $conn) or die(mysql_error());

暂无
暂无

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

相关问题 尝试远程连接到mysql时出现错误2003(HY000) - ERROR 2003 (HY000) while trying to connect to mysql remotely 错误2003(HY000)无法连接到本地主机上的mysql服务器 - ERROR 2003 (HY000) cant connect to mysql server on localhost SQLSTATE [HY000] [2003]无法连接到MySQL服务器 - SQLSTATE[HY000] [2003] Can't connect to MySQL server 错误2003(HY000):无法连接到“本地主机”上的MySQL服务器(10061“未知错误”) - ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061 “Unknown error”) SQLSTATE [HY000]错误,当我尝试使用phpmyadmin在PDO中连接本地数据库时,无法连接到mysql服务器时发生错误 - SQLSTATE[HY000] error,cant connect to mysql server error occurs when i tried to connect the local database in PDO using phpmyadmin 远程 MySQL 连接错误 SQLSTATE[HY000] [2002] - Remote MySQL Connection Error SQLSTATE[HY000] [2002] 远程mysql连接错误是(HY000/1130) - remote mysql connection error is (HY000/1130) PHP & MySQL - SQLSTATE[HY000] [2003] 无法连接到 MySQL 服务器 - 通过 TCP 的许多连接 - PHP & MySQL - SQLSTATE[HY000] [2003] Can't connect to MySQL server - Many Connections over TCP Laravel迁移工作正常,但是当我打开页面时,出现“ SQLSTATE [HY000] [2003]无法连接到'xxxx'上的MySQL服务器(13)”-使用游民 - Laravel migrations work fine, but when I open a page I get “SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'x.x.x.x' (13)” - using vagrant mysqli_connect():(HY000 / 2003):无法连接到“域名”上的MySQL服务器(111) - mysqli_connect(): (HY000/2003): Can't connect to MySQL server on 'domain name' (111)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM