Lnmp the way to turn off Mysql log to protect hard disk space _mysql

Source: Internet
Author: User
Tags vps mysql command line

Let's share the following, the way to close the MySQL log

LNMP a key package installed MySQL default open MySQL log, if the site on the database read and write more frequently may generate a large number of logs, and occupy disk space, but also may lead to the VPS's hard disk idle space consumption full cause the database can not be opened.

The path to this tutorial applies to the LNMP one-click installation package environment, depending on the circumstances.

If you need to close, do the following:

First, modify the file configuration

Modify/ETC/MY.CNF to find the following characters

Log-bin=mysql-bin
Binlog_format=mixedbash

Note the two lines, as follows:

#log-bin=mysql-bin
#binlog_format =mixedbash

Add the "#" note before these two fields and save the file.

Second, restart MySQL to make it effective

Service Mysqld Restartbashssh

Execute the above command, restart MySQL to make annotations effective

Third, delete the log generated before

1) Login MySQL

/usr/local/mysql/bin/mysql-u Root-pbashssh

To execute the above command, enter the MySQL command line mode after entering the password.

2) Reset the account number
Reset Qzkyl;
#qzkyl请修改为目标数据库名

The following are supplementary:

Today found the VPS hard drive incredibly fast full. The first reaction is that it must have been caused by a log file of something, because there had been a similar experience in Windows before.

Analyzed, found the reason: MySQL log file.

You can also use the following command to check (if not lnmp, the path may be different):

Copy Code code as follows:

Du-h--max-depth=1/usr/local/mysql/var/*

If you see a large number of large files, and named mysql-bin.000014, you also need to close the log file, because you do not know which day they will put your VPS hard drive full.

Use WinSCP to remove these files.

How to close:

Copy Code code as follows:

Vi/etc/my.cnf

Found it:

Copy Code code as follows:

Log-bin=mysql-bin
Binlog_format=mixed
[Code]
Comment out these two lines and precede with #
and then save.
Finally, use the following instructions to restart the next lnmp. Wrap
[Code]
/ROOT/LNMP restart

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.