Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have discovered these files located in the wamp\bin\mysql\mysql5.5.24\data folder on my Windows 2008 server.

They are consuming about 22 GB on a 40 GB drive.

enter image description here

I am using a LMS called moodle, that may be kicking off the creation of them, I am not sure.

I am trying to determine:

  1. what is creating these files?

  2. can I delete them to reclaim drive space?

share|improve this question

migrated from stackoverflow.com Dec 4 '12 at 4:59

This question came from our site for professional and enthusiast programmers.

2 Answers 2

up vote 4 down vote accepted

1 - what is creating these files?

Those files are called binary logs. They contain a list of all completed SQL statements you have executed. Your mysqld process created them and autorotates at 1GB. Any restart of mysqld or issuing FLUSH LOGS; will close one binary log and open another

They got created because there is a line in my.ini that looks like this:

log-bin=mysql-bin

Note the timestamps on each file

  • mysql-bin.000068 has 10/31/2012 2:13 PM
  • mysql-bin.000069 has 11/1/2012 11:13 AM
  • mysql-bin.000070 has 11/5/2012 11:51 AM
  • mysql-bin.000071 has 11/9/2012 11:50 AM
  • mysql-bin.000072 has 11/13/2012 11:13 AM
  • mysql-bin.000073 has 11/16/2012 12:05 AM

Here is what has been going

  • On 10/31/2012 at 2:13 PM
    • mysql-bin.000068 surpassed 1GB (1048576 KB)
    • mysql-bin.000068 closed
    • mysql-bin.000069 opened
  • On 11/1/2012 at 11:13 AM
    • mysql-bin.000069 closed due to mysql restart or FLUSH LOGS;
    • mysql-bin.000070 opened
  • On 11/5/2012 at 11:51 AM
    • mysql-bin.000070 closed due to mysql restart or FLUSH LOGS;
    • mysql-bin.000071 opened
  • On 11/9/2012 at 11:50 AM
    • mysql-bin.000071 surpassed 1GB (1048576 KB)
    • mysql-bin.000071 closed
    • mysql-bin.000072 opened
  • On 11/13/2012 at 11:13 AM
    • mysql-bin.000072 closed due to mysql restart or FLUSH LOGS;
    • mysql-bin.000073 opened
  • On 11/16/2012 at 12:05 AM
    • mysql-bin.000073 surpassed 1GB (1048576 KB)
    • mysql-bin.000073 closed
    • mysql-bin.000074 opened

By the way, the reason it autorotates at 1GB? The default setting max-binlog-size is 1GB.

2 - can I delete them to reclaim drive space?

As long as you do not have mysql replication installed, then yes.

First login to mysql and run

mysql> RESET MASTER;

This will erase all binary logs and leave you with mysql-bin.000001 with 107 bytes.

Next, if you comment it out like this

#log-bin=mysql-bin

and restart the mysqld process

C:\> net stop mysql
C:\> net start mysql

The logs will no longer be written.

As a final step, you can then delete mysql-bin.000001 from Windows Explorer.

Give it a Try !!!

share|improve this answer
    
wow - thanks for the great insights. I will and report back my results. –  jamesTheProgrammer Dec 4 '12 at 17:17
    
Awesome... is always good to learn from you Rolando –  Yaroslav Dec 5 '12 at 8:55
    
I replaced full ...\mysql\mysql5.5.24 But it's showing databases, not tables –  KarSho May 7 at 12:29
    
@KarSho Each database directory contains the physical files making up the tables. DO NOT ERASE THEM !!! –  RolandoMySQLDBA May 7 at 12:34
    
i dont know abt physical files and all. Now I replaced fully. What to do? –  KarSho May 7 at 12:43

Those are your database files. Do not to remove them. Mine are not so big (around 300 Mb), but I'm on the development enviroment and I'm using small databases.

In case you want to move them my advice is to use export/import tools on your current mysql admin application, it could be PhpMyAdmin, MySQL Workbench or similar.

Make a search using mysql database wamp tags either here or in StackOverflow and you will get lot of info on wamp and mysql database

Edit

According to your comment you need to do some cleanup in order to see what can be done to shrink the database. I've not used moodle, but a quick search returned this link as one of the results, maybe is what you are looking for:

How to keep a moodle database clean and trim

share|improve this answer
    
I do not want to move anything, just reclaim a bit of disk space. I have DB backups stored on another drive, are these snapshots or duplicates. Can I delete the older ones? Thanks for insights. –  jamesTheProgrammer Dec 4 '12 at 13:41
    
Answer edited, check if now is ok –  Yaroslav Dec 4 '12 at 13:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.