无法连接到本地MySQL服务器,连接丢失,服务器已离开

无法连接到本地MySQL服务器,连接丢失,服务器已离开,mysql,centos,Mysql,Centos,我的服务器有一个非常奇怪的问题 首先,服务器崩溃了。 我使用CPanel和WHM。由于无法访问,我使用SSH重新启动服务器。它起作用了,恢复正常 但很快就出现了一个新问题: 无法通过套接字“/var/lib/MySQL/MySQL.sock”2连接到本地MySQL服务器 MySQL服务器已经消失了 “读取初始通信数据包”时与MySQL服务器的连接中断,系统错误:104 “读取授权数据包”时与MySQL服务器的连接中断,系统错误:104 但是这些错误并不总是存在的,因此站点是在线的,并且可以正常工

我的服务器有一个非常奇怪的问题

首先,服务器崩溃了。 我使用CPanel和WHM。由于无法访问,我使用SSH重新启动服务器。它起作用了,恢复正常

但很快就出现了一个新问题: 无法通过套接字“/var/lib/MySQL/MySQL.sock”2连接到本地MySQL服务器 MySQL服务器已经消失了 “读取初始通信数据包”时与MySQL服务器的连接中断,系统错误:104 “读取授权数据包”时与MySQL服务器的连接中断,系统错误:104

但是这些错误并不总是存在的,因此站点是在线的,并且可以正常工作,只是在某个时候出现了这个问题,或者在CPanel和mysqltuner中也显示了这个错误

我做的第一件事:搜索

我换了我的。cnf加了袜子,没有解决。 我重新启动了服务器,没有解决。 我带着一个旧的my.cnf回来了,它有备份,没有解决。 我尝试将“localhost”更改为“127.0.0.1”,但在“127.0.0.1”上创建了一个无法连接到MySQL服务器的新问题

我试了我能找到的一切。 没有解决任何问题

此外,mysqld的进程总是在重新启动! 在此之前,进程花费数小时/天/周时间而没有重新启动。最上面的命令显示mysqld超过了50小时,时间超过了100小时。但现在,不超过10分钟。换句话说,进程正在重新启动

在-m free中,我有服务器1303 free,最常用的处理器是4.5%的CPU

另一件神秘的事情是,cron的工作不起作用。 我有一个cron任务来截断和插入数据。截断有效,插入/选择无效

需要一些帮助来解决问题。”

我只有这个服务器,带有Centos系统

编辑:
你自己已经回答了部分问题。服务器正在继续重新启动。所以很明显,在重启期间,它有时无法连接到MySQL服务器。你必须弄清楚它为什么会重新启动。可能是cronjob导致了这种情况?cronjob很旧,并且一直有效,每1分钟截断和插入一次,就像tmp表一样:Truncate有效,插入无效。MySQL每10~16分钟就会无故崩溃一次。日志中没有错误:\mysql日志在崩溃时是什么样子的?你能从崩溃前的几行粘贴到崩溃后的一两行吗?粘贴日志中的最后几行。即使没有错误。其中可能有一些有用的信息。我更新了,在日志中发现了错误。我有两个网站在同一个服务器。而且,我认为一张桌子是腐败的。我可以放下它吗?但是,没有删除两个网站的数据?
140910 12:32:01  InnoDB: error: space object of table 'w_w/SRands',
InnoDB: space id 274796 did not exist in memory. Retrying an open.
InnoDB: Error: tried to read 16384 bytes at offset 0 0.
InnoDB: Was only able to read 0.
140910 12:32:01  InnoDB: Operating system error number 0 in a file operation.
InnoDB: Error number 0 means 'Success'.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/operating-system-error-codes.html
InnoDB: File operation call: 'read'.
InnoDB: Cannot continue operation.
140910 12:32:01 mysqld_safe Number of processes running now: 0
140910 12:32:01 mysqld_safe mysqld restarted
140910 12:32:02 [Warning] Using unique option prefix join_buffer instead of join_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
140910 12:32:02 [Note] Plugin 'FEDERATED' is disabled.
140910 12:32:02 InnoDB: The InnoDB memory heap is disabled
140910 12:32:02 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140910 12:32:02 InnoDB: Compressed tables use zlib 1.2.3
140910 12:32:02 InnoDB: Using Linux native AIO
140910 12:32:02 InnoDB: Initializing buffer pool, size = 119.0M
140910 12:32:02 InnoDB: Completed initialization of buffer pool
140910 12:32:02 InnoDB: highest supported file format is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn 395690234452
140910 12:32:02  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Error: the size of single-table tablespace file ./w_w/SRands.ibd
InnoDB: is only 0 0, should be at least 65536!InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 395690846835
140910 12:32:02  InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 5$
InnoDB: Apply batch completed
140910 12:32:03  InnoDB: Error: table 'w_w/SRands'
InnoDB: in InnoDB data dictionary has tablespace id 274796,
InnoDB: but tablespace with that id or name does not exist. Have
InnoDB: you deleted or moved .ibd files?
InnoDB: This may also be a table created with CREATE TEMPORARY TABLE
InnoDB: whose .ibd and .frm files MySQL automatically removed, but the
InnoDB: table still exists in the InnoDB internal data dictionary.
InnoDB: Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/innodb-troubleshooting-datadict.html
InnoDB: for how to resolve the issue.
140910 12:32:03  InnoDB: Waiting for the background threads to start
140910 12:32:04 InnoDB: 5.5.37 started; log sequence number 395690846835
140910 12:32:04 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
140910 12:32:04 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
140910 12:32:04 [Note] Server socket created on IP: '0.0.0.0'.
140910 12:32:04 [Note] Event Scheduler: Loaded 1 event
140910 12:32:04 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.5.37-cll'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)