博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
问题解决Starting MySQL.. ERROR! The server quit without updating PID file
阅读量:5820 次
发布时间:2019-06-18

本文共 4133 字,大约阅读时间需要 13 分钟。

  hot3.png

今天发现MySQL突然无法访问,启动服务报错

Starting MySQL.. ERROR! The server quit without updating PID file[FAILED]....pid

 141910_qvof_3750151.png

查看MySQL进程,报错

MySQL is not running,but lock file (/var/lock/subsys/mysql[FAILED]

删除这个mysql文件也没用。

最后发现原来是MySQL日志撑爆了磁盘空间,导致无法写入日志,删除部分日志即可。

142630_F7K4_3750151.png

其实可以设置日志记录策略,如果单机MySQL则完全没有必要日志,注释日志记录配置

注释/etc/my.cnf中

#log-bin=mysql-bin#binlog_format=mixed

或者设置日志过期时间,保留7天日志

在/etc/my.cnf中添加

expire_logs_days = 7

 

排错记录如下:

起初找不到错误日志,设置记录错误日志

/etc/my.cnf

添加内容

log_error = /var/log/mysql/error.log

增加错误日志目录

mkdir /var/log/mysql

再次启动服务,发现日志

180112 11:11:28 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql180112 11:11:29 [Note] Plugin 'FEDERATED' is disabled.180112 11:11:29 InnoDB: The InnoDB memory heap is disabled180112 11:11:29 InnoDB: Mutexes and rw_locks use GCC atomic builtins180112 11:11:29 InnoDB: Compressed tables use zlib 1.2.3180112 11:11:29 InnoDB: Using Linux native AIO180112 11:11:29 InnoDB: Initializing buffer pool, size = 128.0M180112 11:11:29 InnoDB: Completed initialization of buffer pool180112 11:11:29 InnoDB: highest supported file format is Barracuda.InnoDB: The log sequence number in ibdata files does not matchInnoDB: the log sequence number in the ib_logfiles!180112 11:11:29  InnoDB: Database was not shut down normally!InnoDB: Starting crash recovery.InnoDB: Reading tablespace information from the .ibd files...InnoDB: Restoring possible half-written data pages from the doublewriteInnoDB: buffer...InnoDB: Last MySQL binlog file position 0 831375219, file name ./mysql-bin.000016180112 11:11:29  InnoDB: Waiting for the background threads to start180112 11:11:30 InnoDB: 5.5.31 started; log sequence number 9124484533180112 11:11:30 [Note] Recovering after a crash using mysql-bin180112 11:11:32 [ERROR] Error in Log_event::read_log_event(): 'read error', data_len: 428, event_type: 2180112 11:11:32 [Note] Starting crash recovery...180112 11:11:32 [Note] Crash recovery finished.03:11:32 UTC - mysqld got signal 11 ;This could be because you hit a bug. It is also possible that this binaryor one of the libraries it was linked against is corrupt, improperly built,or misconfigured. This error can also be caused by malfunctioning hardware.We will try our best to scrape up some info that will hopefully helpdiagnose the problem, but since we have already crashed, something is definitely wrong and this may fail.key_buffer_size=16777216read_buffer_size=262144max_used_connections=0max_threads=151thread_count=0connection_count=0It is possible that mysqld could use up to key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 134077 K  bytes of memoryHope that's ok; if not, decrease some variables in the equation.Thread pointer: 0x0Attempting backtrace. You can use the following information to find outwhere mysqld died. If you see no messages after this, something wentterribly wrong...stack_bottom = 0 thread_stack 0x40000/usr/sbin/mysqld(my_print_stacktrace+0x35)[0x7aa975]/usr/sbin/mysqld(handle_fatal_signal+0x4a4)[0x6831a4]/lib64/libpthread.so.0[0x3894c0f710]The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html containsinformation that should help you find out what is causing the crash.180112 11:11:32 mysqld_safe mysqld from pid file /var/lib/mysql/******.pid ended

最终尝试寻找磁盘空间问题

运行df -lh

Filesystem                        Size  Used Avail Use% Mounted on/dev/mapper/vg_research2-lv_root   50G   47G  5.3M 100% /tmpfs                              16G     0   16G   0% /dev/shm/dev/sda1                         485M   39M  421M   9% /boot/dev/mapper/vg_research2-lv_home  484G  308G  152G  67% /home

删除部分MySQL操作日志,服务启动成功

[root@cm ~]# df -lhFilesystem                        Size  Used Avail Use% Mounted on/dev/mapper/vg_research2-lv_root   50G   44G  3.1G  94% /tmpfs                              16G     0   16G   0% /dev/shm/dev/sda1                         485M   39M  421M   9% /boot/dev/mapper/vg_research2-lv_home  484G  308G  152G  67% /home[root@cm ~]# service mysql restartShutting down MySQL....                                    [  OK  ]Starting MySQL..                                           [  OK  ]

 

转载于:https://my.oschina.net/gore/blog/1606118

你可能感兴趣的文章
红黑树
查看>>
UIImagePickerController拍照与摄像
查看>>
python调用windows api
查看>>
第四章 mybatis批量insert
查看>>
Java并发框架——什么是AQS框架
查看>>
【数据库】
查看>>
Win配置Apache+mod_wsgi+django环境+域名
查看>>
linux清除文件内容
查看>>
WindowManager.LayoutParams 详解
查看>>
find的命令的使用和文件名的后缀
查看>>
Android的Aidl安装方法
查看>>
Linux中rc的含义
查看>>
曾鸣:区块链的春天还没有到来| 阿里内部干货
查看>>
如何通过Dataworks禁止MaxCompute 子账号跨Project访问
查看>>
js之无缝滚动
查看>>
Django 多表联合查询
查看>>
logging模块学习:basicConfig配置文件
查看>>
Golang 使用 Beego 与 Mgo 开发的示例程序
查看>>
ntpdate时间同步
查看>>
+++++++子域授权与编译安装(一)
查看>>