Importing old Mantis database+data to new Mantis install?

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
newmantisuser
Posts: 68
Joined: 06 Aug 2012, 18:13

Importing old Mantis database+data to new Mantis install?

Post by newmantisuser »

Hello,

We currently run and old version of Mantis, 1.1.2 on Linux Ubuntu 10 with MySQL version 5.0.51 and I have been asked by Management to upgrade to the latest version of Mantis (1.2.12). I have a VM sandbox setup to test the installation (Linux Ubuntu 10 and MySql) and upgrade process. I have read the mantis administration guide, especially the upgrading and backup sections but things are still a little unclear for me.

I could 'just upgrade' my existing installation to the latest version but I would rather setup Mantis and import all our data from our production system over to my test environment as I am weary of messing with the production server as it is critical to our business.

I have a few questions if someone could help me out.

1. I would like to backup my existing MySQL databases, copy them over to thew VM sandbox and import them into the new installation. I know the command to do this which is
mysqldump -u<username> -p<password> <database name> > backup.sql. Do I need to use the --all-databases flag to get them all imported into the backup.sql file? If I just go with <database name> such as mantis_pit that means I am only backing up the mantis_pit database right?

Since our existing MySQL database contains many databases such as

darwindbs/mantis_pit.sql
darwindbs/experiments.sql
darwindbs/mantis_cal.old.sql
darwindbs/drupal.sql
darwindbs/redmine.sql
darwindbs/trac_buriedtargets.sql
darwindbs/mantis_cal.sql
darwindbs/mysql.sql
darwindbs/mantis_3.sql
darwindbs/mantis3.sql

do I have to manually create empty MySQL databases in my sandbox to match the names from our production system before importing?

Ok so lets say that I make a backup and transfer it over to my sandbox..how do I get the data into the MySQL database to test? Normally you would restore the database using this command:
mysql -u<username> -p<password> <database name> < <input file>.

What is the input file in this case?

2. Do the databases need to be shutdown to perform the import and exports? We just use Webmin so I assume webmin shuts down MySQL before doing a backup....

3. Is there any other data that I might just want to copy from our old system and load into the test environment? I assume just copying /var/www/mantis/ to our new test environment would not work.

Thanks so much for any and all replies. I have attached our production system mantis and my new instillation. The goal is to have them both be identical.
Attachments
fresh install in test env
fresh install in test env
2.png (40.3 KiB) Viewed 18874 times
production system
production system
1.png (34.74 KiB) Viewed 18874 times
atrol
Site Admin
Posts: 8555
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Importing old Mantis database+data to new Mantis install

Post by atrol »

1. export database on old machine (no need to shutdown, no need to export all databases, check your config_inc.php for the right one)
2. import database on new machine (the <input file> is the name of the file you generated when exporting your database, "backup.sql" in your example)
3. unpack new MantisBT 1.2.11 on new system
4. transfer your customizations (config_inc.php, ...) from old system
5. adjust database settings in config_inc.php if needed (mabye you changed database name, user or password)
6. run admin/install.php
7. if you store your attachments on disk you have to transfer also the attachments

You should use a MySQL forum to get support if there are any database related issues.
Please use Search before posting and read the Manual
newmantisuser
Posts: 68
Joined: 06 Aug 2012, 18:13

Re: Importing old Mantis database+data to new Mantis install

Post by newmantisuser »

Thanks you so much for your reply!!!!!!!!!!!!!!!!!

Your steps worked perfectly. I have everything up and running now. I did run into issues with logging in, adding notes and attachments etc...which was all related to an AUTO_INCREMENT setting, but I was able to get them the issues resolved mainly by doing the following:

mysql> ALTER TABLE mantis_tokens_table MODIFY COLUMN id INT NOT NULL AUTO_INCREMENT; (this particular table was being referenced when I tried to change my password)

The error I was getting was simliar to these. In this example I was trying to add notes to issues and submit them.

mantis adding note error Duplicate entry '0' for key 'PRIMARY' for the query: INSERT INTO mantis_bugnote_text_table ( note ) VALUES ( ? ).

Anyway once again I am very greatful for your post sir. Really appreciate you taking the time to help out a fellow mantis user. :)
Post Reply