Suddenly I encountered a case of MySQL not being able to start , so I recorded it. I believe friends who saw the title have already guessed the reason why it cannot be started. The server is in the LNMP environment of the Linux system. Suddenly, an access failure occurred. The machine was running normally and could log in via SSH normally. So I logged in immediately and tried to restart LNMP. I found that the MySQL database could not be stopped (continuously...), and it died again after a few seconds of starting. !
After various checks, I accidentally found that 100% of the hard disk space is used. It is basically determined that the disk is full. MySQL cannot start because this VPS has a 50GB disk and the source code occupies less than 1G, so the command search Large files (use the find command: Review ), find the large file path located in the /usr/local/mysql/var/ directory, which is the MySQL log binlog, a large number of files named mysql-bin.*, and Each file size is up to 1GB.
binlog
As shown in the picture above, according to this progress, the hard disk will be filled up very quickly every day, so you need to temporarily disable the log first, modify the /etc/my.cnf file, and find the following two Comment out the lines:
***Be sure to stop MySQL before commenting***
/etc/init.d/mysql stop
Then comment out the following two lines in my.cnf (just add # in front of it) )
log-bin=mysql-bin
binlog_format=mixed
Restart MySQL after completion
/etc/init.d/mysql restart
Next we can delete all or part of mysql- bin.* files, after disabling logs, no more new log files will be generated. As for the reason why there are so many logs suddenly, you need to check slowly.
In addition, I directly deleted the mysql-bin.* files. The standard method should be to clean up the command under MySQL:
/usr/local/mysql/bin/mysql -u root -p
reset master ;
###Note that the command includes a semicolon

postid
17466

Leave a Reply