Solved

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

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Fore-Foreword Today (2016) Maxmind has a new approach to the distribution of its data sets.  This article may be obsolete.  Instead of using the examples here, have a look at the MaxMind API (https://www.maxmind.com/en/geolite2-developer-package). …
Foreword This article was written many years ago, in the days when PHP supported the MySQL extension (http://php.net/manual/en/function.mysql-connect.php).  Today (http://php.net/manual/en/migration70.removed-exts-sapis.php) you would not use MySQL…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

791 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