Page 1 of 1
Clearing mantis database
Posted: 07 Nov 2006, 16:29
by mchamp
I played with Mantis and it's what we were looking for.
Now, I would like to clear the database and start logging real problems.
How do I do that ?
Thanks

Posted: 08 Nov 2006, 01:45
by redjen
I usually do this by dropping, then re-creating the mantis database in mysql.
But first!
Posted: 08 Dec 2006, 01:06
by hmackiernan
If you only want to clear out the bugs you've submitted and keep your users and other customizations, you can issue the following SQL to the database
[here I am assuming you're using mysql, your mantis database is named 'bugs' and the table prefix is 'mantis_', the default:
use database bugs;
delete from mantis_bug_table where 1=1;
then, if you want your bug numbers to start once more from '1',
issue this SQL statement:
ALTER TABLE mantis_bug_table AUTO_INCREMENT = 1;
Actually... I spoke too soon... there's more:
Posted: 12 Jan 2007, 19:22
by hmackiernan
there are other tables you'd want to truncate as well to clear out bug data:
this SQL should do it:
-- remove all bug data, text, and history
DELETE FROM `mantis_bug_table` WHERE 1;
DELETE FROM `mantis_bug_history_table` WHERE 1;
DELETE FROM `mantis_bug_relationship_table` WHERE 1;
DELETE FROM `mantis_bug_text_table` WHERE 1;
DELETE FROM `mantis_bugnote_table` WHERE 1;
DELETE FROM `mantis_bugnote_text_table` WHERE 1;
-- re-set the autoincrement fields for those tables so that new
-- defects start at '1'
ALTER TABLE `mantis_bug_table`AUTO_INCREMENT = 1;
ALTER TABLE `mantis_bug_history_table`AUTO_INCREMENT = 1;
ALTER TABLE `mantis_bug_relationship_table`AUTO_INCREMENT = 1;
ALTER TABLE `mantis_bug_text_table`AUTO_INCREMENT = 1;
ALTER TABLE `mantis_bugnote_table`AUTO_INCREMENT = 1;
ALTER TABLE `mantis_bugnote_text_table`AUTO_INCREMENT = 1;
Re: Clearing mantis database
Posted: 11 Jan 2013, 16:50
by salomaowk
This post was perfect to my situation.
There's only one problem, if you look up using this forum search engine nothing like this comes up, but if you use GOOGLE search with simple key words "mantis+clear+database" then you have a lot of previous information.
So, thanks GOOGLE... again...