首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从PHP连接到MySQL问题

问从PHP连接到MySQL问题
EN

Stack Overflow用户
提问于 2010-09-28 21:39:10
回答 1查看 758关注 0票数 0

尝试安装roundcube -有一些与驱动程序配置相关的问题-我现在非常确定驱动程序已经配置好了-我收到了一个错误:

代码语言:javascript
复制
"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."

现在,这来自以下文件:

代码语言:javascript
复制
<?php
// hostname or ip of server (for local testing, localhost should work)
$dbServer='localhost';

// username and password to log onto db server
$dbUser='*****';
$dbPass='*****';

// name of database
$dbName='roundcubemail';

    $link = mysql_connect("$dbServer", "$dbUser", "$dbPass")or die(mysql_error());
    print "Connected successfully<br>";
    mysql_select_db("$dbName") or die("Could not select database");
    print "Database selected successfully<br>";

// close connection
mysql_close($link);
?>

用户名和通行证都很好。事实上,我可以使用相同的凭据通过Toad连接到db实例。

在MSSQL中,你可能需要告诉服务器允许来自远程机器的连接等等--但是通过php连接和通过Toad连接肯定是一样的?

我已经尝试设置127.0.0.1而不是localhost,以防需要通过服务器名进行连接。还是没有joy。

为了让它正常工作,我还需要配置什么吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-09-28 22:15:48

我将服务器更改为127.0.0.1:3306,它已连接!!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3813293

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档