Announcement

Collapse
No announcement yet.

Can I do new install with current database?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can I do new install with current database?

    Can I do a new install (of 7.x) but use the current database? Will the installer recognize the already filled up database?

    In the past I would create a new empty database, install Espo with parms for new database, and then do a MySQLDump of the 'old' database and then do an import to the new one.

    Can I omit the dump and import process? Is the installer smart enough to allow this? (i.e does the code in the installer say "CREATE TABLE IF NOT EXISTS ..." )

  • #2
    You can try! But I don't think other willing to test trial this method with you. The developer certaintly would suggest such a method. And considering quite many installation issue at the moment there isn't a self-repair or integrity check system in EspoCRM yet.

    I think it could work with hiccup you be discover over a few days if not weeks.

    Comment


    • #3
      Yes, you can.

      Account passwords (user passwords, IMAP passwords etc) will be invalid, as a salt and key will be changed.

      Comment


      • #4
        Account passwords (user passwords, IMAP passwords etc) will be invalid, as a salt and key will be changed.
        I took the two config files from the 'good" install and popped the into the previously broken install. I went in with a text editor and changed the database name and the URL to what it should be for this install.

        I tried to log in using the username and password from the 'good' install seeing as the config-internal.php file will have the salt and key for it.

        Did not work. I got "Wrong username/password"

        Do I need to get into the database (via MyPhpAdmin) and change something?

        It must have something to do with the salt or cryptKey. Any idea what I can do to get the correct user/pass? I know what they SHOULD be but nothing I enter works.

        How about this: Could I go into config.php and change this from true to false:

        'isInstalled' => true,

        and run the program and re-do another install? You say it will see I already have a database. Would doing this give me a new config files with new user, pass, salt, etc?

        Comment


        • #5
          Make sure that these items are copied from your old installation: "'passwordSalt", "cryptKey", "hashSecretKey"

          You can also check this post for instructions to restore an installation manually: https://forum.espocrm.com/forum/inst...1187#post61187

          Comment


          • #6
            Originally posted by telecastg View Post
            Make sure that these items are copied from your old installation: "'passwordSalt", "cryptKey", "hashSecretKey"

            I tried the above, but it didn't work. So I just downloaded a fresh copy of 7.03, unzipped it, checked on permissions and changed the user:group to www-data on both, and ran the install process using the user/pass of the existing data base. EspoCRM is smart enough to know that a database with tables already exists and so it did not try to create new tables etc.

            I then did the upgrade (as www-data) and obtained 7.05 without any issues.

            Now if I can just find the script commands to dump my production database and update the backup database with any new records that might be available I'll be done. Somewhere there is some sample code to do this, I just need to find it... or take the time to write it myself.

            Comment


            • bruce185
              bruce185 commented
              Editing a comment
              Did the trick...

          • #7
            Now if I can just find the script commands to dump my production database and update the backup database with any new records that might be available I'll be done. Somewhere there is some sample code to do this, I just need to find it... or take the time to write it myself.
            You don't need a special script, just do a simple export to an sql script from your production database using PhpAdmin and then import that into the new database. This process is also described in the link that I gave you.

            Comment


            • #8
              Originally posted by telecastg View Post

              You don't need a special script, just do a simple export to an sql script from your production database using PhpAdmin and then import that into the new database. This process is also described in the link that I gave you.
              I know the process. I simply want to automate this into a bash script I can run each night via cron. It is basically two mysql commands... one of them being "mysqldump" and the other one I've not yet found... but I will... eventually! Hmmm... may PhpMyAdmin will show me the code it uses. I'll check it out.

              Comment


              • #9
                I leaned something today. I have two identical installs of Espo... one for production and one for backup. If for some reason the production system gets trashed, I have the backup system.

                The task is to dump the production EspoCRM database so I can update the backup database. Basically it is a 'reload' of the backup database.

                Each system has a different username and password (for security.)

                If you do a plain mysqldump including the user table, after the update is done, the backup system gives you a "wrong username/password" error when you try to log in.

                The key is to NOT dump the user table.

                Here are the two commands in case anyone is interested in ever doing this:

                # Dump the production file but NOT the user table (note --ignore)

                /usr/bin/mysqldump --login-path=production_db -eqf --add-drop-table production_db --ignore-table=production_db.user > espocrm-to-update-bak.sql


                # Restore the backup database from the dump above

                mysql backup_db < espocrm-to-update-bak.sql

                Maybe this will help someone.


                Comment


                • telecastg
                  telecastg commented
                  Editing a comment
                  Excellent tip, thanks for posting it.
              Working...
              X