Solved

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

Posted on 2008-10-21
2
620 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In this article, I will by showing a nice little trick for MySQL similar to that of my previous EE Article for SQLite (http://www.sqlite.org/), A SQLite Tidbit: Quick Numbers Table Generation (http://www.experts-exchange.com/A_3570.htm…
Creating and Managing Databases with phpMyAdmin in cPanel.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

910 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

22 Experts available now in Live!

Get 1:1 Help Now