本文介绍了连接错误-SQLSTATE [HY000] [2002]操作超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法从Windows 2008 R2的应用程序服务器连接到也在Windows 2008 R2上运行的MySQL服务器.

I am having trouble connecting from my application server which is a Windows 2008 R2 box to MySQL Server box also running on Windows 2008 R2.

Laravel应用程序报告错误:

The Laravel application reports the error:

exception 'PDOException' with message 'SQLSTATE[HY000] [2002] Operation timed out'

奇怪的是,我可以使用完全相同的凭据和端口通过MySQL Workbench从应用程序服务器连接到MySQL Server,并且连接很快.

The odd thing is I can connect via MySQL Workbench from the application server to the MySQL Server using exactly the same credentials and port, and the connection is quick.

任何人都可以阐明这是怎么回事吗?

Can anyone shed any light on how this can be?

推荐答案

检查.env文件或config \ database.php文件,设置正确的用户名,密码,数据库名称,IP和端口.

Check .env file or config\database.php file, set correct username, password, database name, ip and port.

这篇关于连接错误-SQLSTATE [HY000] [2002]操作超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 20:20