Friday 6 February 2015

How to delete MySQL Binary logs Files in Wamp Server?

How to delete MySQL Binary logs Files in Wamp Server?



Sometime we find our Wamp Server is talking too much space like 10GB whereas it must take less than the current size. It may be your mysql binary log files are taking too much space in data.
Binary files look like below:
mysql-bin.000001,
mysql-bin.000002,
................,
mysql-bin.000221

Before we delete the mysql binary log files permanently, we should know about these binary log files like what type of files are these and how effect our server.


Question: What is Mysql Binary logs file?
MySQL binary logs are the text file, created by mysql automatically. Default files name are "mysql-bin.000001" which located in data folder of mysqlx.x.


Question: What is purpose of Binary logs file?
It has two purpose
Data Recovery: It is used for data recovery operations.
High availability / replication: It is used on master replication servers as a record of the statements to be sent to slave servers.


Question: What is default location of binary log file?
E:\wamp\bin\mysql\mysql.x.x\data


Question: How can change the Binary log file name?
Open my.ini file under mysql.x.x folder.
In my window system:
E:\wamp\bin\mysql\mysql.x.x\my.ini


Question: Update the following "mysql-bin" name
log-bin=mysql-bin


Question: How to disable the automatic creating binary log files?
Open my.ini file under mysql.x.x folder.
In my window system: E:\wamp\bin\mysql\mysql.x.x\my.ini
Search
log-bin=mysql-bin
and replace with following
#log-bin=mysql-bin



Question: What is dis-advantage of mysql binary log files?
Its takes too much space, some times it take upto 10MB or more space.


Question: How to delete mysql bin files permanently?
It have 3 steps and are following.

Step 1: Disable automatic creating file.
open my.ini file under mysql.x.x folder.
Search
log-bin=mysql-bin
and Replace with following
#log-bin=mysql-bin

Step 2:
Restart Wamp Server

Step3 :
Now you can delete all files start with "mysql-bin.0000xx"

Never delete mysql bin files directly you must follow Step 1