删除mysql日志后启动不了mysqld服务的解决方法

网站建设 提交于 2019-01-24 19:29:43

最近发现一台服务器的硬盘空间莫名其妙地多用了十几G,觉得很奇怪,经过查找原来是MySQL的日志文件占用,产生了大量体积很大的以mysql-bin.000**命名的文件,足足有十几G,于是直接删除了这些bin文件,然后用service mysqld restart命令重启mysql,发现启动失败,提示如下:

删除mysql二进制日志后mysqld启动不了网站打不开的解决方法

root@iZ2zealv4rhkwnr02mgju7Z:~# service mysqld restart
Job for mysqld.service failed because the control process exited with error code.
See "systemctl status mysqld.service" and "journalctl -xe" for details.
root@iZ2zealv4rhkwnr02mgju7Z:~# systemctl status mysqld.service
● mysqld.service - LSB: start and stop MariaDB
   Loaded: loaded (/etc/init.d/mysqld; generated; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2019-01-19 08:57:44 CST; 17s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1080 ExecStart=/etc/init.d/mysqld start (code=exited, status=1/FAILURE)

Jan 19 08:57:41 iZ2zealv4rhkwnr02mgju7Z systemd[1]: Starting LSB: start and stop MariaDB...
Jan 19 08:57:41 iZ2zealv4rhkwnr02mgju7Z mysqld[1080]: Starting MariaDB
Jan 19 08:57:42 iZ2zealv4rhkwnr02mgju7Z mysqld[1080]: .190119 08:57:42 mysqld_safe Logging to '/data/mariadb/mysql-error.log'.
Jan 19 08:57:42 iZ2zealv4rhkwnr02mgju7Z mysqld[1080]: 190119 08:57:42 mysqld_safe Starting mysqld daemon with databases from /data/mariadb
Jan 19 08:57:44 iZ2zealv4rhkwnr02mgju7Z mysqld[1080]: .. failed!
Jan 19 08:57:44 iZ2zealv4rhkwnr02mgju7Z systemd[1]: mysqld.service: Control process exited, code=exited status=1
Jan 19 08:57:44 iZ2zealv4rhkwnr02mgju7Z systemd[1]: Failed to start LSB: start and stop MariaDB.
Jan 19 08:57:44 iZ2zealv4rhkwnr02mgju7Z systemd[1]: mysqld.service: Unit entered failed state.
Jan 19 08:57:44 iZ2zealv4rhkwnr02mgju7Z systemd[1]: mysqld.service: Failed with result 'exit-code'.

解决方法如下:

打开my.cnf文件(一般默认在 /etc/ 目录下)找到以下代码删除或前面加#注释掉,然后输入service mysqld restart重启mysqld服务即可。

log_bin = mysql -bin

binlog_format = mixed

expire_logs_days = 7

删除mysql日志网站打不开的解决方法

 

 

标签

如果文章对你有帮助,请赞赏支持本站发展!

发表评论

此字段内容将保密,不会被其他人看见。