mysql_real_connect出错,如何修复“ mysqli :: real_connect():SSL操作失败”错误?

Environment:

Ubuntu 14.04, PHP 5.5.9, MYSQL 5.6.30

From time to time I get an error

mysqli::real_connect(): SSL operation failed with code 1. OpenSSL

Error message:

error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number

Front/nginx is on one server and mysql is on a different server.

The error is not continuous, it happens randomly and I find those error messages in error log so I cannot really do full debug.

Sample:

mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);

$this->objMySqli = mysqli_init();

mysqli_options ($this->objMySqli, MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, true);

$this->objMySqli->ssl_set($this->SslKey, $this->SslCertificate, $this->SslCACertificate, null, null);

$link = $this->objMySqli->real_connect($this->Server, $this->Username, $this->Password, $this->Database, $this->Port);

if (!$link) {

throw new QMySqliDatabaseException("Unable to connect to Database", -1, null);

}

SSL Cipher:

KHzmM.png

It fails on this line:

$link = $this->objMySqli->real_connect($this->Server, $this->Username, $this->Password, $this->Database, $this->Port);

解决方案

It is problem with mysql version 5.6.30,

I have updated to 5.6.32 and now this error is not happening anymore.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值