刪除mysql-bin.0000X日志文件的方法
由于mysql-bin.0000X日志文件的存在,經(jīng)常導(dǎo)致數(shù)據(jù)庫(kù)文件不大的情況下卻能產(chǎn)生幾個(gè)G以上的日志文件,下面就教您刪除mysql-bin.0000X日志文件的方法。
[root@jiucool var]#/usr/local/mysql/bin/mysql -u root -p
Enter password: (輸入密碼)
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 264001
Server version: 5.1.35-log Source distribution
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql>reset master; (清除日志文件)
Query OK, 0 rows affected (8.51 sec)
mysql>
好了,我們?cè)賮聿榭聪?a >mysql文件夾占用多少空間?
[root@jiucool var]#du -h –max-depth=1 /usr/local/mysql/
37M /usr/local/mysql/var
70M /usr/local/mysql/mysql-test
15M /usr/local/mysql/lib
448K /usr/local/mysql/include
2.9M /usr/local/mysql/share
7.6M /usr/local/mysql/libexec
17M /usr/local/mysql/bin
11M /usr/local/mysql/docs
2.9M /usr/local/mysql/sql-bench
163M /usr/local/mysql/
好了,看一下,整個(gè)mysql 目錄才占用163M大小!OK,沒問題,既然mysql-bin.0000X日志文件占用這么大空間,存在的意義又不是特別大,那么我們就不讓它生成吧.
[root@jiucool var]#find / -name my.cnf
找到了my.cnf 即mysql配置文件,我們將log-bin=mysql-bin 這條注釋掉即可.
# Replication Master Server (default)
# binary logging is required for replication
#log-bin=mysql-bin
重啟下mysql吧.
OK,至此,刪除mysql-bin.0000X日志文件操作完成. 以后再不會(huì)因?yàn)榫蛶资甅的數(shù)據(jù)庫(kù)大小生成N個(gè)G的日志文件啦。
【編輯推薦】