Home > Database > Mysql Tutorial > body text

lnmp下如何关闭Mysql日志保护磁盘空间_MySQL

WBOY
Release: 2016-05-30 17:10:27
Original
1237 people have browsed it

 LNMP一键包安装的Mysql默认开启Mysql日志,如果网站对数据库读写较为频繁的话可能会产生大量日志,并占用磁盘空间,还有可能导致VPS的硬盘闲置空间消耗满导致数据库无法开启。

本教程的路径适用于LNMP一键安装包环境,其它环境请根据实际情况操作。

若需要关闭,请执行以下操作:

代码如下:


log-bin=mysql-bin
binlog_format=mixedbash

注释这两行,如下:

代码如下:


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

在这两个字段之前添加“#”号注释,并保存文件。

代码如下:


service mysqld restartbash

SSH执行以上命令,重启Mysql使注释生效

代码如下:


/usr/local/mysql/bin/mysql -u root -pbash

SSH执行以上命令,输入密码后,进入MYSQL命令行模式。

2)重设帐号

代码如下:


reset qzkyl;        #qzkyl请修改为目标数据库名

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!