Solved

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

Posted on 2008-10-21
2
624 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

749 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