CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • Rebuild 1.9 db to Ensure Schema Integrity in phpMyAdmin ??
Pages: [1]

Author Topic: Rebuild 1.9 db to Ensure Schema Integrity in phpMyAdmin ??  (Read 4759 times)

speleo

  • Ask me questions
  • ****
  • Posts: 396
  • Karma: 28
  • CiviCRM version: 4.3.1
  • CMS version: J! 2.5,9
  • MySQL version: 5.1
  • PHP version: 5.3.24
Rebuild 1.9 db to Ensure Schema Integrity in phpMyAdmin ??
February 22, 2008, 06:44:51 pm
OK...my upgrade to v2.0b2 from 1.9.12432 failed at step 2. No problem I thought I'll just restore my db and run through step 2 (Rebuild your 1.9 Database to Ensure Schema Integrity) which is detailed at http://wiki.civicrm.org/confluence/display/CRMDOC/Upgrade+Joomla+Sites+to+2.0

Quote
Rebuild your 1.9 Database to Ensure Schema Integrity
   If your 1.9 database has been upgraded from a prior version - and you did not previously run these steps - you must complete the following steps in order to prevent errors during the upgrade to 2.0.

    * Create a new empty database. We'll call it civicrm19Fix for this example.
    * Load the 1.9 table structure into this new database by sourcing civicrm/sql/civicrm_41.mysql (in your existing 1.9 codebase).

      shell > mysql -u crm_db_username -pcrm_db_password civicrm19Fix < civicrm_41.mysql

    * Dump the data ONLY from your existing 1.9 database to a file:

      shell > mysqldump -u crm_db_username -pcrm_db_password -c -e -n -t civicrm19 > dumpFile

    * Populate the new empty database with your data by sourcing the dumped file:

      shell > mysql -u crm_db_username -pcrm_db_password civicrm19Fix < dumpFile

I created a new table civicrm19Fix and granted user rights to it. However I couldn't get the scripts to run against this. Kept get 1045 access denied errors. Maybe my host has locked down shell mysql access....?

So can this be done in phpMyAdmin?

Recreating the empty schema is achieved by using the import function and pointing to the civicrm_41.mysql file. This method could be used for importing the dump file too.

But how to create the dump file? What does -c -e -n -t mean?

     -c  complete insert statements
     -e  (--extended inserts) Allows utilization of the new, much faster INSERT syntax
     -n  (--no-create-db) This option suppresses the CREATE DATABASE statements that are otherwise included in the output if the --databases or --all-databases option is given.
     -t  (--no-create-info) Do not write CREATE TABLE statements that re-create each dumped table.

So would this do the trick?

Options
          Add custom comment into header (\n splits lines) [leave blank]
          [    ] Enclose export in a transaction
          [    ] Disable foreign key checks
          SQL compatibility mode [NONE]

[    ] Structure
          [    ] Add DROP TABLE / DROP VIEW
          [    ] Add IF NOT EXISTS
          [    ] Add AUTO_INCREMENT value
          [    ] Enclose table and field names with backquotes
          [    ] Add CREATE PROCEDURE / FUNCTION
          Add into comments
          [    ] Creation/Update/Check dates
[ x ] Data
          [ x ] Complete inserts
          [ x ] Extended inserts
          Maximal length of created query [a big number??]
          [    ] Use delayed inserts
          [    ] Use ignore inserts
          [    ] Use hexadecimal for BLOB
          Export type [ INSERT ]

Trying this gives a FK error on the acl table straight off. Can I disable the FK checks and still have a valid install?

Think I'll give this a go when I've got more time...

Michał Mach

  • Ask me questions
  • ****
  • Posts: 748
  • Karma: 59
    • CiviCRM site
  • CiviCRM version: latest
  • CMS version: Drupal and Joomla latest
  • MySQL version: numerous
  • PHP version: 5.3 and 5.2
Re: Rebuild 1.9 db to Ensure Schema Integrity in phpMyAdmin ??
February 23, 2008, 05:53:48 am
Quote from: speleo on February 22, 2008, 06:44:51 pm
So can this be done in phpMyAdmin?

Not savvy enough in phpMyAdmin to answer your question (I'm sure there will be someone though), but what I can recommend is still using mysqldump, through remote connection though. If you don't have shell access to your server to run mysqldump/mysql/mysqladmin directly there, you can still run in elsewhere (just need to have mysql command line client installed), but try to connect to remote server by using these two options:

--host=name (-h name)
--port=# (-P port)

So if your database server is running for example on database.domain.com on port 3306, than you issue this command:
mysqldump -h database.domain.com -P 3306 -u crm_db_username -pcrm_db_password -c -e -n -t civicrm19 > dumpFile

Same works for 'mysql' and 'mysqladmin' commands.

Thx
m
« Last Edit: February 23, 2008, 05:55:30 am by Michał Mach »
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

My absolute favourite: Wordpress Integration!.

Donate Now!

speleo

  • Ask me questions
  • ****
  • Posts: 396
  • Karma: 28
  • CiviCRM version: 4.3.1
  • CMS version: J! 2.5,9
  • MySQL version: 5.1
  • PHP version: 5.3.24
Re: Rebuild 1.9 db to Ensure Schema Integrity in phpMyAdmin ??
February 23, 2008, 09:24:17 am
Michal, Thanks this has got my though this part of it. I don't know why but I really struggled due to getting access denied errors. In the end I did this:

On a SSH shell I ran
mysql -u crm_db_username -pcrm_db_pword db_civicrm19Fix < civicrm_41.mysql;


from a local mySQL  prompt on my PC I ran from C:\wamp\mysql\bin
mysqldump -h domain.com -P 3306 -u crm_db_username -pcrm_db_pword -c -e -n -t db_civicrm > dumpFile.sql

Copy the dumpfile up to the root of the servers and On a SSH shell I then ran
mysql -u crm_db_username -pcrm_db_pword db_civicrm19Fix < dumpFile.sql;

now I just need to try the upgrade! fingers crossed.

speleo

  • Ask me questions
  • ****
  • Posts: 396
  • Karma: 28
  • CiviCRM version: 4.3.1
  • CMS version: J! 2.5,9
  • MySQL version: 5.1
  • PHP version: 5.3.24
Re: Rebuild 1.9 db to Ensure Schema Integrity in phpMyAdmin ??
February 23, 2008, 09:51:53 am
 :) :) :) I just ran the upgrade on my normalised db and it worked!!!

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Rebuild 1.9 db to Ensure Schema Integrity in phpMyAdmin ??
February 23, 2008, 05:38:52 pm
Harry - If you could document this approach in a "Troubleshooting" section at the bottom of the Upgrade documentation - that would be awesome. Maybe put an anchor link like "'Don't have shell mysql access?" - in the main section...
Protect your investment in CiviCRM by  becoming a Member!

speleo

  • Ask me questions
  • ****
  • Posts: 396
  • Karma: 28
  • CiviCRM version: 4.3.1
  • CMS version: J! 2.5,9
  • MySQL version: 5.1
  • PHP version: 5.3.24
Re: Rebuild 1.9 db to Ensure Schema Integrity in phpMyAdmin ??
February 24, 2008, 09:36:42 am
Dave,

I could do this if you want but one of the reasons why I was able to do this was because I had already got my host to enable port 3306 for my ip. Realistically the other approach to do this would be to replicate the db on a local WAMP setup (make sure it has InnoDB) and handle it all there and then move the db back onto the server after normalisation.

Might be better to document this approach. Would take me a bit more time to put this together...

Henry

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Rebuild 1.9 db to Ensure Schema Integrity in phpMyAdmin ??
February 24, 2008, 06:57:13 pm
Ok - that's cool if / when you can get to it :-)
Protect your investment in CiviCRM by  becoming a Member!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • Rebuild 1.9 db to Ensure Schema Integrity in phpMyAdmin ??

This forum was archived on 2017-11-26.