Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 636
  • Last Modified:

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

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
mark_667
Asked:
mark_667
1 Solution
 
UmeshMySQL Principle Technical Support EngineerCommented:
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
 
mark_667Author Commented:
Thanks, that's really useful
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now