This forum is no longer active. Please post your questions to our new community site

Forums Redmine

Fresh install of RS Redmine - how to bring old db across

Subscribe to Fresh install of RS Redmine - how to bring old db across 14 post(s), 4 voice(s)

 
Avatar prexpressions 9 post(s)

Having tried and failed various other upgrade routes I finally downloaded bitnami-redmine-0.9.2-0-windows-installer.exe. Which worked perfect and now I have Redmine 0.9.2 up and running. Really easy and very pleased :-)

All good but obviously it does not have my issues in it. Having looked at numerous links on upgrading I believe I can not simply restore my 0.8.6 db into this Redmine instance as the backed up SQL drops the new tables and replaces them with the older backed up table formats.

So I need to import (migrate?) how do I do this? The commands I have seen suggest “rake db:migrate RAILS_ENV=production” if this is the case how does it know where to get the old db contents from?

Note: I am running Windows Server 2008 standard.

Thanks in advance
Paul

 
Avatar giordano 12 post(s)

@prexpressions

My friend I will try to give you a step by step from the beginning and for this you have to have access to your old redmine running. I will assume that you have installed in the default folder, so from now on I will call it installdir .

1) Make a dump of the old database. Open the redmine console (installdir\use_redmine.bat) and run the following:

mysqldump -u root -p bitnami_redmine > redmine_backup.sql

This operation could take some time depending on the data size. Copy this file to a safe place.

2) Copy the folder installdir\apps\redmine\files and .yml files from the config also to a safe place.

3) Now in the new Redmine system open the console and do the following:

mysql -u root -p

drop database bitnami_redmine;
create database bitnami_redmine;
grant all privileges on bitnami_redmine.* to ’bitnami’@’localhost’ identified by ‘BITNAMI_USER_PASSWORD’;

the password should be the one you used in your old system for the administrator user

flush privileges;
exit;

4) Using the file you saved before:

mysql -u root -p bitnami_redmine < redmine_backup.sql

5) Now, from the console, go to the redmine folder and run:

cd installdir\apps\redmine
rake db:migrate RAILS_ENV=“production”
rake tmp:cache:clear
rake tmp:sessions:clear

6) Copy the folder files to the new correspondent place and also the .yml files. Restart the system and should be all running good!

If you have a test machine, this is a good time to experiment this. Good luck!

Thanks ScottR, Beltran, Bitnami Redmine Backup Tutorial and everybody!

 
Avatar prexpressions 9 post(s)

Thanks for the reply giordano.

I did step 1 and 2, and then uninstalled my old RubyStack (and Redmine), as I was having various issues before installing the latest Redmine RubyStack.

If I do step 3 that you suggest, when and how will the old data stored in the ‘redmine_backup.sql’ file get loaded into the new database. Or do I have to restore the old redmine instance – which is now dead and gone?

(It also strikes me by dropping the table the new redmine db format is lost – and therefore just recreating the old db format in the new redmine instance sounds a strange thing to do, is this safe?)

Thanks again for your support

 
Avatar prexpressions 9 post(s)

Since I posted the last comment you have added more steps so it makes far more sense to me!

Now I get the message Access denied for user ’bitnami’@’localhost’ (using password: YES)

In the mysql grant command I tried:
grant all privileges on bitnami_redmine.* to ’bitnami’@’localhost’ identified by ‘BITNAMI_USER_PASSWORD’;

grant all privileges on bitnami_redmine.* to ’bitnami’@’localhost’ identified bythe password for the admin user of the old system, which is the same as the new system;

grant all privileges on bitnami_redmine.* toadmin user name@’localhost’ identified bythe password for the admin user of the old system, which is the same as the new system;

grant all privileges on bitnami_redmine.* to ’bn_redmine’@’localhost’ identified by ‘BITNAMI_USER_PASSWORD’; (bn_redmine being the user name listed in my old database.yml file)

All give exactly the same Access denied message_ even after dropping and recreating the database at each attempt.

For Step 5 I have also tried:

rake db:migrate RAILS_ENV=“production”

rake db:migrate RAILS_ENV=production

set RAILS_ENV=production
rake db:migrate

set RAILS_ENV=“production”
rake db:migrate

The last one failing with a different message suggesting “production” is not the way to go

Again any help is really appreciated – we feel blind without our issues db

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Hi,

There are two different passwords:

1. The MySQL root password, which is the same that the Remdine administrator password. You only use this issue to access manually to the database. For example:

mysql -u root -p

2. The password of the “bitnami” database user. This password is random and you can find it in the /apps/redmine/config/database.yml.

So you should run the following command:

grant all privileges on bitnami_redmine.* to ’bitnami’@’localhost’ identified by ‘BITNAMI_USER_PASSWORD’;

Where “BITNAMI_USER_PASSWORD” is the password that you can find in the /apps/redmine/config/database.yml file.

I hope it helps.

 
Avatar prexpressions 9 post(s)

> Where “BITNAMI_USER_PASSWORD” is the password that you can find in the /apps/redmine/config/database.yml file.

Ah ha a top secret piece of information and with that knowledge I have been able to migrate! But now I get internal error when trying to access my Redmine db via ‘Access BitNami Redmine Stack’ from the Bitnami page.

Question: My original database.yml has a production username of ‘bn_redmine’ the freshly installed Bitnami Redmine stack database.yml has a production username of ‘bitnami’. How exactly do I need to handle this situation?

So should I start the new Redmine stack with the original database.yml, create the db, and grant privileges to ‘bitnami’ or ‘bn_redmine’? Once the migrate completes, should I replace the database.yml and then stop-start the system?

I feel like we are making progress towards the goal so many thanks for your help, just a little more please :-)

 
Avatar giordano 12 post(s)

@prexpressions

Sorry for so many edits in my first post. I was kinda late here (little bit sleepy)… If I remember it right, you found the last piece of the puzzle by yourselft. At the end, when you finish migrating, you replace the .yml with the old one and restart the service.

See if it works. Cheers.

 
Avatar prexpressions 9 post(s)

Finally I have it back!
Cheers to Giordano and Beltran’s for your help!
Paul

The full sequence:
1 Download the latest Bitnami Redmine Stack (the full thing, not the module which will not work if various other bits of the RubyStack are not updated) do the steps below while waiting for the download
2 Open a Bitnami cmd line window: Start→Bitnami Redmine Stack→Use Bitnami Redmine Stack (run as adminstrator)
3 Backup old db: mysqldump -uroot -p bitnami_redmine > redmine_backup.sql
4 Copy the backed up sql to somewhere convienent
5 Stop services: Start→Bitnami Redmine Stack→Bitnami Redmine Stack Service→Stop BitNami Redmine Stack service (run as adminstrator)
6 Wait till the temporary command line have windows disappeared
7 Exit the Bitnami command line window
8 Copy the current Bitnami RubyStack folder to some backup folder
9 Uninstall the current Bitnami installation: Start→Bitnami Redmine Stack→Uninstall BitNami Redmine Stack
10 Once the download is finished, installer the latest Bitnami Rubystack – use the same usernames and passwords as before
11 Start the new services: Start→Bitnami Redmine Stack→Bitnami Redmine Stack Service→Start BitNami Redmine Stack service (run as adminstrator)
12 Check the new Redmine is functional and empty of issues
13 Open a Bitnami cmd line window: Start→Bitnami Redmine Stack→Use Bitnami Redmine Stack (run as adminstrator)
14 Start a mysql session: mysql -uroot -p
15 Delete the current empty db: drop database bitnami_redmine;
16 Make a fresh empty db: create database bitnami_redmine;
17 Set the privileges: grant all privileges on bitnami_redmine.* to ’’@’localhost’ identified by ‘’; The production username and passwords are in the NEW Redmine\config\database.yml – the password is encoded
18 Flush the privilieges: flush privileges;
19 Exit the msql session: exit;
20 Check that the database name is still ‘bitnami_redmine’: look in the new RubyStack\apps\redmine\config\database.yml
21 Copy the backed up sql file to apps\Redmine in the new installation (copy here as convienent later)
22 Change to this location: cd \apps\redmine
23 Import this data into the new db: mysql -uroot -p<your (new) sql root password> bitnami_redmine < redmine_backup.sql
24 Set the RAILS_ENV environment variable to point to the production db: set RAILS_ENV=production (no quotes here please)
25 Perform the migration (you could pray before this step if you think it will help): rake db:migrate
26 Tidy up1: rake tmp:cache:clear
27 Tidy up2: rake tmp:sessions:clear
28 Exit the command line window
29 Stop the services: Start→Bitnami Redmine Stack→Bitnami Redmine Stack Service→Stop BitNami Redmine Stack service (run as adminstrator)
30 Copy from the old installation the redmine\files folder to the new installations same location, over writing the delete.me file
31 Copy the old apps\Redmine\config\database.yml and email.yml (don’t copy settings.yml) to the same location in the new installation
32 Start the new services: Start→Bitnami Redmine Stack→Bitnami Redmine Stack Service→Start BitNami Redmine Stack service (run as adminstrator)
33 Now check it works!
34 If it does back up the db now!

 
Avatar giordano 12 post(s)

Congrats! Great work!

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Nice! I’m glad to hear this. Thanks for posting all the steps. I’m sure this post will be helpful for other BitNami Redmine users.

 
Avatar tompierce 2 post(s)

RE: Step 31 Copy the old apps\Redmine\config\database.yml and email.yml (don’t copy settings.yml)
If the NEW bitnami_redmine database has privileges for the user/password in the NEW database.yml (step 17), then won’t copying the old database.yml mess things up?
Or am I missing something?

 
Avatar prexpressions 9 post(s)

All I can say is this is what I had to do to get it to work – it took over a week to go through all the permutations! Maybe Giodano or beltan can answer you better.

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

@tompierce Yes, you are right.

 
Avatar tompierce 2 post(s)

Thanks guys!

Forums Redmine