Page 1 of 1

mysql TRUNCATE TABLE!!!

Posted: Mon Oct 02, 2017 4:36 pm
by ponnpr7
I was advice by one the Nagios engineer while doing the demo explaining the Nagios XI function and features. So this was the told to clear the ton of logs. I'm not really familiar with mysql, any help will be great.

mysql> echo 'TRUNCATE TABLE nagios_logentries;' | mysql -u root -p nagiosxi nagios;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the ht syntax to use near 'echo

Thanks,
Ravi Ponnaiah

Re: mysql TRUNCATE TABLE!!!

Posted: Mon Oct 02, 2017 4:51 pm
by dwhitfield
That command is for if you are not logged in to mysql. Since you are, you can simply run the following...assuming you are using the nagios db:

TRUNCATE TABLE nagios_logentries;

If you are not using the nagios db, just run the following command first:
use nagios;

If you logged in as root, you should have access to do this on nagios db.

Re: mysql TRUNCATE TABLE!!!

Posted: Tue Oct 03, 2017 1:21 pm
by ponnpr7
ok got it thanks.

Re: mysql TRUNCATE TABLE!!!

Posted: Tue Oct 03, 2017 1:25 pm
by dwhitfield
It sounds like this issue has been resolved. Is it okay if we lock this thread? Thanks for choosing the Nagios forums!