Linux start MySQL prompt: Timeout error occurred trying to start MySQL Daemon

Source: Internet
Author: User
Tags apache log

A long time to display when starting mysqld
Timeout error occurred trying to start MySQL Daemon.
Display when terminal enters MySQL
ERROR 2002 (HY000): Can ' t connect to local MySQL server through socket '/var/lib/mysql/mysql.sock ' (2)

Later found to be/var/log/httpd/the next log file will be full of disk space caused by the deletion after the restart of the server is good.

Apache Log management and large log cleanup methods

There are three ways to round the Web server log:
The first approach is to take advantage of the Linux system's own log file rotation mechanism: logrotate;
The second method is to take advantage of Apache's own log round-robin program Rotatelogs;
The third is to use the FAQ in Apache to recommend the development of a more mature log round tool cronolog.

What I bring to you here is to use Apache's own log-round program rotatelogs, and to periodically delete log files with shell scripts, keeping only the files for nearly 3 days, so that the log files are full of
disk space.
Modify Master Profile httpd.conf
to find the following and modify it to:
errorlog/var/log/httpd/error_log
Customlog "|/usr/local/apache2/bin/rotatelogs  /var/log/httpd/access_log 86400 400M" Combined
# 86400   ---Log scrolling time is one day
# 400      ---Log file up to 400M scroll
# Combined---in composite format

then establish a shell script to purge the log files, file name Clean_log
#!/bin/bash
logdir=/var/log/httpd
CD ${logdir}
Declare-i filesum= ' ls access_log.* | Wc-l '
declare-i delnum= $filesum-3
If ["${delnum}"-ge 1];then
rm-rf ' ls-tr access_log.* | Head-${delnum} ' Br>fi

chmod 755 Clean_log
This preserves the last 3 days of log files.

Setting up an Automation task
/usr/local/crontab/clean_log
OK, it's that simple. So you don't have to worry about the growing log files!

Linux start MySQL prompt: Timeout error occurred trying to start MySQL Daemon

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.