Solved

How to clear down mysql binary logs from a batch file?

Posted on 2008-10-21
2
619 Views
Last Modified: 2012-05-05
I have a script which runs this:
"C:\Program Files\mysql\bin\mysql" -uroot -prootpasswd < C:\ClearBinaryLogs.sql

ClearBinaryLogs.sql:
use db
PURGE MASTER LOGS BEFORE 'NOW()';

doesn't clear anything but seems to complete without any errors and all the paths are correct, anyone have any ideas?
0
Comment
Question by:mark_667
2 Comments
 
LVL 26

Accepted Solution

by:
ushastry earned 125 total points
ID: 22773532
No need to use "use db" and in fact you can write into single line as

"C:\Program Files\mysql\bin\mysql" -uroot -prootpasswd -e "PURGE MASTER LOGS BEFORE NOW( );"


Better ad a single line to your my.ini/my.cnf which does automatically and no need to schedule a batch job..

expire_logs_days=1
0
 
LVL 1

Author Closing Comment

by:mark_667
ID: 31508271
Thanks, that's really useful
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

A lot of articles have been written on splitting mysqldump and grabbing the required tables. A long while back, when Shlomi (http://code.openark.org/blog/mysql/on-restoring-a-single-table-from-mysqldump) had suggested a “sed” way, I actually shell …
Creating and Managing Databases with phpMyAdmin in cPanel.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now