Results 1 to 4 of 4

Thread: How do reinstall and keep the old database?

  1. #1
    dschell is offline Junior Member
    Join Date
    Jul 2006
    Posts
    2

    Default How do reinstall and keep the old database?

    Fedora Core 4
    SugarSuite 4.0.0 I think
    mysql 4.0.24
    php 5.0.4
    webserver apache 2.0.54


    My server crashed and had to be rebuilt. I have a copy of the database, but not the sugar install. How can I install Sugar and restore the database? If I install Sugar and copy the database back, I get
    "Sugar CRM 4.0.1f Files May Only Be Used With A Sugar CRM 4.0.1 Database." This makes sense, but since I can't find a copy of 4.0.0, I am kinda stuck. Any help would be greatly appreciated.

    I believe the version of sugar I had running before was 4.0.0.
    mysql> select * from versions;
    +--------------------------------------+---------+---------------------+---------------------+------------------+------------+-----------------------+--------------+------------+
    | id | deleted | date_entered | date_modified | modified_user_id | created_by | name | file_version | db_version |
    +--------------------------------------+---------+---------------------+---------------------+------------------+------------+-----------------------+--------------+------------+
    | cd33c9d2-3c8a-2940-b081-438db46889be | 0 | 2005-11-30 14:16:27 | 2005-11-30 14:16:27 | | | Custom Labels | 3.0 | 3.0 |
    | ce94e0ac-24d9-2baa-4aef-438db4ff454a | 0 | 2005-11-30 14:16:27 | 2005-11-30 14:16:27 | | | Chart Data Cache | 3.5.1 | 3.5.1 |
    | cfd359cd-2c33-7aa1-d047-438db49fb7f2 | 0 | 2005-11-30 14:16:27 | 2005-11-30 14:16:27 | | | htaccess | 3.5.1 | 3.5.1 |
    | 52b62c9e-80b7-0f47-e7ef-438db608aac3 | 0 | 2005-11-30 14:24:44 | 2005-11-30 14:24:44 | 1 | 1 | DST Fix | 3.5.1b | 3.5.1b |
    | 270eaaab-ca6e-ad00-04bf-43a5916a216e | 0 | 2005-12-18 16:44:05 | 2005-12-18 16:44:05 | 1 | 1 | Rebuild Relationships | 4.0.0 | 4.0.0 |
    | 234642f5-5eef-2690-a4d5-43a5914f8157 | 0 | 2005-12-18 16:44:28 | 2005-12-18 16:44:28 | 1 | 1 | Rebuild Extensions | 4.0.0 | 4.0.0 |
    +--------------------------------------+---------+---------------------+---------------------+------------------+------------+-----------------------+--------------+------------+
    6 rows in set (0.01 sec)

  2. #2
    malcolmh's Avatar
    malcolmh is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Aug 2004
    Posts
    1,712

    Default Re: How do reinstall and keep the old database?

    Hi,

    Try looking at the table upgrade_history instead of versions, Look at the fields "type" with the value "patch" and there you can see the version you had last installed.

    Hope this helps to get you going again
    Cheers Malcolm

    Genius4U Limited - Ingenious simple IT solutions for you / Genial einfache IT Lösungen für Sie
    http://www.genius4u.com or http://www.genius4u.de

  3. #3
    dschell is offline Junior Member
    Join Date
    Jul 2006
    Posts
    2

    Default Re: How do reinstall and keep the old database?

    Quote Originally Posted by malcolmh
    Hi,

    Try looking at the table upgrade_history instead of versions, Look at the fields "type" with the value "patch" and there you can see the version you had last installed.

    Hope this helps to get you going again
    Thanks. Looking in table upgrade_history, I found it was indeed 4.0.0 and was able to find a copy of SugarSuite-4.0.0.zip at sourceforge. I installed 4.0.0 and restored the database by reinserting the values from a mysqldump of the database.


    Just to make it easy on anyone following my footsteps later....

    Since I had the database intact, I made a dump of the database and wrote it to the file sugar.dump:
    mysqldump -u<dbuser> -p<dbpasswd> sugarcrm > sugar.dump

    This included all the create statements which I removed by hand, so it may be easier to do:
    mysqldump --no-create-info -u<dbuser> -p<dbpasswd> sugarcrm > sugar.dump

    Then I installed sugar following the manual (using the same version I had -- see the table upgrade_history). It is probably best to do this to a new database with a different name, as the install will drop all the data in your old one.

    Then I restored the data from the dump.
    mysql -u<dbuser> -p<dbpasswd> sugarcrm < sugar.dump

    I ran into a few errors. For example, when it tried to insert the admin account it was already there. Keep in mind, this process goes through the dump file line by line until it gets an error. When it runs into an error it tells you where, but just stops. You have to start from that point (or you are reinserting data) once you fix the error, so everything before the error has to go. I made a copy of my dump file and just deleted stuff out of it as I went.

  4. #4
    malcolmh's Avatar
    malcolmh is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Aug 2004
    Posts
    1,712

    Default Re: How do reinstall and keep the old database?

    Glad to be helpful
    Cheers Malcolm

    Genius4U Limited - Ingenious simple IT solutions for you / Genial einfache IT Lösungen für Sie
    http://www.genius4u.com or http://www.genius4u.de

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •