drupal 没有mysql,Drupal安装无法连接到MySQL服务器,但是已经存在「建议收藏」

drupal 没有mysql,Drupal安装无法连接到MySQL服务器,但是已经存在「建议收藏」I’mgettingthefollowingerrorinstallingdrupal7:Failedtoconnecttoyourdatabaseserver.Theserverreportsthefollowingmessage:SQLSTATE[HY000][2003]Can’tconnecttoMySQLserveron’myserv…

大家好,又见面了,我是你们的朋友全栈君。

drupal 没有mysql,Drupal安装无法连接到MySQL服务器,但是已经存在「建议收藏」

I’m getting the following error installing drupal 7:

Failed to connect to your database server. The server reports the following message: SQLSTATE[HY000] [2003] Can’t connect to MySQL server on ‘myservername’ (13).

I am running MySQL on one windows server and httpd on another linux. MySQL is running just fine and on the httpd server I can connect just fine to the MySQL, as follows:

mysql -h dbserver -p –port=3001 -u drupal

Similarly I can run mysqli and pdo and it connection just fine too from my httpd:

$servername = “dbserver”;

$username = “drupal”;

$password = “xxx”;

$dbname = “drupal”;

$port = 3001;

$conn = new mysqli($servername, $username, $password, $dbname, $port);

if ($conn->connect_error) {

die(“Connection failed: ” . $conn->connect_error);

}

echo “Connected successfully”;

$conn->close();

try {

$conn = new PDO(“mysql:host=$servername;dbname=$dbname;port=$port”, $username, $password);

// set the PDO error mode to exception

$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

echo “Connected successfully”;

}

catch(PDOException $e)

{

echo “Connection failed: ” . $e->getMessage();

}

$conn=null;

?>

So there is nothing wrong on my web server or php or mysql. It’s just through the installation that it fails. I’ve been in the advanced and entered all the correct details.

Any idea? I looked and there was no apache log and I couldn’t figure out how to increase error reporting during install or find exactly where it does the database connection check..

thanks.

解决方案

Can you confirm you have dbserver’s ip mapped.

Go to terminal and type : “ping dbserver” and please post result.

EDITED: This situation was caused by a security policy of the linux distro where the apache server is setup that doesn’t allow it to connect to remote mysql instances. For solving this situation go to terminal and type sudo setenforce 0, that way linux won’t enforce such strict webserver behaviour.

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/162248.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 一阶惯性滤波电路图_matlab比例微分环节

    一阶惯性滤波电路图_matlab比例微分环节MATLAB中进行软件滤波仿真我身边有些朋友说现在在学校学习什么拉氏变换,Z变换,傅立叶变换没有用,传递函数没有用,差分方程没有用,只是纸上谈兵,我这里先就传递函数和拉氏变换和差分方程介绍几点不自量力的看法,我们学习拉氏变换主要是为了从脱离时域,因为时域分析有它的难度指数,我们从时域映射到S域,目的只有一个,那就是简化计算,正如我们在时域要计算卷积过来,卷积过去,我们把它映射到S域过后,就是乘积过…

    2022年9月27日
    3
  • 关系数据模型的三个组成部分中不包括_数据模型常用组成部分

    关系数据模型的三个组成部分中不包括_数据模型常用组成部分关系数据模型的三个组成部分(1)关系数据模型的数据结构;(2)关系数据模型的操作集合;(3)关系数据模型的完整性约束;

    2025年6月28日
    4
  • 百度网站链接怎么分享_url的组成部分有哪些

    百度网站链接怎么分享_url的组成部分有哪些百度分享默认分享的是当前页的url,但也可以在同一个页面中分享多个不同的url,仅需进行如下简单的配置。默认的代码如下:其实是有很多隐藏的参数的:’bdDes’:’您的自定义分享摘要’, //’请参考自定义分享摘要”text’:’您的自定义分享内容’, //’请参考自定义分享内容”title’:’您的自定义pop窗口标题’, //’请参考自定义p

    2022年10月8日
    3
  • pytest运行_python缓存机制

    pytest运行_python缓存机制前言pytest运行完用例之后会生成一个.pytest_cache的缓存文件夹,用于记录用例的ids和上一次失败的用例。方便我们在运行用例的时候加上–lf和–ff参数,快速运行上一

    2022年7月30日
    10
  • cacti网络监控工具完全指南

    cacti网络监控工具完全指南

    2021年8月14日
    81
  • Flowable 快速入门教程:Flowable 入门开发案例,结合流程设计器详细讲解

    Flowable 快速入门教程:Flowable 入门开发案例,结合流程设计器详细讲解Flowable快速入门教程:Flowable入门开发案例,结合流程设计器详细讲解前言流程设计器集成整体流程图项目结构流程部署启动流程流程节点说明第一审核人节点:实际设置审核人配置信息说明第二审核人:参数设置审核人配置信息说明第三审核人:参数分支判断与实际组配置配置信息说明h前言本文以一个简答的Demo为案例,按节点讲解,目的是为了让刚接触流程引擎的人能更快的熟悉流程引擎开发,了解业务…

    2022年5月21日
    40

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号