简体   繁体   English

HY000 2006 MySQL 服务器不见了

[英]HY000 2006 MySQL server has gone away

So, I saw that there is a lot of questions about this problem, but i couldn't find any solution.所以,我看到有很多关于这个问题的问题,但我找不到任何解决方案。 I try in PHP to connecto to my database on hosting server but I get this: [HY000] [2006] MySQL server has gone away我尝试用 PHP 连接到我的托管服务器上的数据库,但我得到了这个: [HY000] [2006] MySQL 服务器已经消失

The code of PHP file looks like this: PHP 文件的代码如下所示:

<?php

$mysqli = new mysqli('database_addres', 'user', '', "database_name");

?>

I don't make some query calls or something like that.我不做一些查询电话或类似的事情。 I tried to connect by PDO and mysql_connect() , but there is the same error.我尝试通过 PDO 和mysql_connect()进行连接,但出现相同的错误。 connect_timeout is set to 10, wait_timeout to 200, innodb_buffer_pool_size to 536870912. So everything seems to be ok. connect_timeout设置为 10, wait_timeout设置为 200, innodb_buffer_pool_size为 536870912。所以似乎一切正常。 Do I miss something?我错过了什么吗?

The MySQL server has gone away (error 2006) has two main causes and solutions: Server timed out and closed the connection. MySQL 服务器消失(错误 2006)有两个主要原因和解决方案: 服务器超时和关闭连接。 To fix, check that wait_timeout mysql variable in your my.cnf configuration file is large enough.要修复,请检查 my.cnf 配置文件中的wait_timeout mysql 变量是否足够大。

Server dropped an incorrect or too large packet.服务器丢弃了不正确或过大的数据包。 If mysqld gets a packet that is too large or incorrect, it assumes that something has gone wrong with the client and closes the connection.如果 mysqld 收到一个太大或不正确的数据包,它会假定客户端出现问题并关闭连接。 To fix, you can increase the maximal packet size limit max_allowed_packet in my.cnf file, eg.要修复,您可以增加 my.cnf 文件中的最大数据包大小限制max_allowed_pa​​cket ,例如。 set max_allowed_packet = 128M, then restart your MySQL server: sudo /etc/init.d/mysql restart设置max_allowed_pa​​cket = 128M,然后重启你的 MySQL 服务器: sudo /etc/init.d/mysql restart

暂无
暂无

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

相关问题 将 Laravel 连接到 XAMPP MySQL (MariaDB) 数据库 SQLSTATE[HY000] [2006] MySQL 服务器已经消失 - Connecting Laravel to XAMPP MySQL (MariaDB) database SQLSTATE[HY000] [2006] MySQL server has gone away SQLSTATE [HY000]:常规错误:2006 MySQL服务器已消失,无法创建临时表 - SQLSTATE[HY000]: General error: 2006 MySQL server has gone away creating temporary table Symfony 3 : SQLSTATE[HY000] [2006] MySQL 服务器在更新模式期间消失了 - Symfony 3 : SQLSTATE[HY000] [2006] MySQL server has gone away during update schema mysqli_real_connect():(HY000 / 2006):MySQL服务器已消失 - mysqli_real_connect(): (HY000/2006): MySQL server has gone away 尝试连接时出现“ SQLSTATE [HY000] [2006] MySQL服务器已消失” - I am getting “SQLSTATE[HY000] [2006] MySQL server has gone away” when attempting to connect mysqli_connect(): (HY000/2006): MySQL 服务器已经消失 - mysqli_connect(): (HY000/2006): MySQL server has gone away PDO例外:SQLSTATE [HY000] [2006] MySQL服务器已经消失了xampp - PDO Exception:SQLSTATE[HY000] [2006] MySQL server has gone away with xampp Doctrine\\DBAL\\Driver\\PDOException SQLSTATE[HY000] [2006] MySQL 服务器已经消失 - Doctrine\DBAL\Driver\PDOException SQLSTATE[HY000] [2006] MySQL server has gone away 警告:mysqli_connect(): (HY000/2006): MySQL 服务器已经消失 - Warning: mysqli_connect(): (HY000/2006): MySQL server has gone away Piwik升级到MySQL 5.7+ SQLSTATE [HY000]:常规错误:2006 MySQL服务器已消失-由插件操作引起 - Piwik upgrading to MySQL 5.7+ SQLSTATE[HY000]: General error: 2006 MySQL server has gone away - caused by plugin Actions
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM