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) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • #1217 - Cannot delete or update a parent row: a foreign key constraint fails
Pages: [1]

Author Topic: #1217 - Cannot delete or update a parent row: a foreign key constraint fails  (Read 13855 times)

leupi

  • I post frequently
  • ***
  • Posts: 192
  • Karma: 2
#1217 - Cannot delete or update a parent row: a foreign key constraint fails
October 19, 2009, 10:57:25 am
I had a Windows installation of CiviCRM on Drupal and have just set up a server with Linux and installed Drupal and CiviCRM on that. I wanted to import the database that I had on the Windows install and import that to the Linux install. I tried but I am getting the following error:

Code: [Select]
Error

SQL query:

--
-- Database: `civicrm`
--
-- --------------------------------------------------------
--
-- Table structure for table `civicrm_acl`
--
DROP TABLE IF EXISTS `civicrm_acl` ;

MySQL said: Documentation
#1217 - Cannot delete or update a parent row: a foreign key constraint fails

Any thoughts on what I might be doing wrong?

Thanks,
Todd

Matt2000

  • I post frequently
  • ***
  • Posts: 288
  • Karma: 27
    • http://www.ninjitsuweb.com
Re: #1217 - Cannot delete or update a parent row: a foreign key constraint fails
October 19, 2009, 11:55:51 am
Drop the database on the new server & re-create an empty database (no tables) before importing the old database.
Drupal/CiviCRM micro-blogging http://twitter.com/matt2000

Ninjitsu Web Development http://www.NinjitsuWeb.com/

leupi

  • I post frequently
  • ***
  • Posts: 192
  • Karma: 2
Re: #1217 - Cannot delete or update a parent row: a foreign key constraint fails
October 19, 2009, 01:00:28 pm
I tried that. I dropped the table, created another, and did a successful import. When I tried to log in to drupal I got the following error message:
<code>
    * warning: mkdir() [function.mkdir]: Permission denied in /opt/lampp/htdocs/drupal/sites/all/modules/civicrm/CRM/Utils/File.php on line 115.
    * warning: mkdir() [function.mkdir]: No such file or directory in /opt/lampp/htdocs/drupal/sites/all/modules/civicrm/CRM/Utils/File.php on line 115.
    * warning: mkdir() [function.mkdir]: No such file or directory in /opt/lampp/htdocs/drupal/sites/all/modules/civicrm/CRM/Utils/File.php on line 115.
    * warning: mkdir() [function.mkdir]: No such file or directory in /opt/lampp/htdocs/drupal/sites/all/modules/civicrm/CRM/Utils/File.php on line 115.
    * warning: mkdir() [function.mkdir]: Permission denied in /opt/lampp/htdocs/drupal/sites/all/modules/civicrm/CRM/Utils/File.php on line 115.
    * warning: mkdir() [function.mkdir]: No such file or directory in /opt/lampp/htdocs/drupal/sites/all/modules/civicrm/CRM/Utils/File.php on line 115.
    * warning: mkdir() [function.mkdir]: No such file or directory in /opt/lampp/htdocs/drupal/sites/all/modules/civicrm/CRM/Utils/File.php on line 115.
    * warning: mkdir() [function.mkdir]: No such file or directory in /opt/lampp/htdocs/drupal/sites/all/modules/civicrm/CRM/Utils/File.php on line 115.
</code>

The line on 115 is:
<code>
CRM_Utils_File::createDir( dirname( $path ), $abort );
        if ( mkdir( $path, 0777 ) == false ) {
            if ( $abort ) {
                $docLink = CRM_Utils_System::docURL2( 'Moving an Existing Installation to a New Server or Location', false, 'Moving an Existing Installation to a New Server or Location' );
                echo "Error: Could not create directory: $path.<p>If you have moved an existing CiviCRM installation from one location or server to another there are several steps you will need to follow. They are detailed on this CiviCRM wiki page - {$docLink}. A fix for the specific problem that caused this error message to be displayed is to set the value of the config_backend column in the civicrm_domain table to NULL. However we strongly recommend that you review and follow all the steps in that document.</p>";
                exit( );
            } else {
                return false;
            }
        }
        return true;
    }
</code>
I have little to no MySQL (or any database experience) to speak of so I'm not really sure what that is telling me. What is the document in the above error? Not sure where it's located.

Thanks again,
Todd

Matt2000

  • I post frequently
  • ***
  • Posts: 288
  • Karma: 27
    • http://www.ninjitsuweb.com
Re: #1217 - Cannot delete or update a parent row: a foreign key constraint fails
October 19, 2009, 01:33:51 pm
First, make sure the files directories specified in civicrm.settings.php are correct & writeable.

After that, you may need to run this SQL:

Code: [Select]
UPDATE civicrm_domain SET config_backend = NULL;
Drupal/CiviCRM micro-blogging http://twitter.com/matt2000

Ninjitsu Web Development http://www.NinjitsuWeb.com/

leupi

  • I post frequently
  • ***
  • Posts: 192
  • Karma: 2
Re: #1217 - Cannot delete or update a parent row: a foreign key constraint fails
October 21, 2009, 12:00:48 pm
I looked in the file civicrm.settings.php and everything seemed to be correct. I am having trouble running

UPDATE civicrm_domain SET config_backend = NULL;

I went to /opt/lampp/bin/ and ran 'mysql' and at the prompt I got the error message:

mysql> UPDATE civicrm_domain SET config_backend = NULL;
ERROR 1046 (3D000): No database selected
mysql>

If there is a way to run this from phpmyadmin, I could not find it. Any thoughts on what I am doing wrong?

Thanks for all of your help.

Todd

It now seems that the data were imported into the civicrm database, it's just that I get the following errors when I log into the site:


    * warning: mkdir() [function.mkdir]: Permission denied in /opt/lampp/htdocs/drupal/sites/all/modules/civicrm/CRM/Utils/File.php on line 115.
    * warning: mkdir() [function.mkdir]: No such file or directory in /opt/lampp/htdocs/drupal/sites/all/modules/civicrm/CRM/Utils/File.php on line 115.
    * warning: mkdir() [function.mkdir]: No such file or directory in /opt/lampp/htdocs/drupal/sites/all/modules/civicrm/CRM/Utils/File.php on line 115.
    * warning: mkdir() [function.mkdir]: No such file or directory in /opt/lampp/htdocs/drupal/sites/all/modules/civicrm/CRM/Utils/File.php on line 115.
    * warning: mkdir() [function.mkdir]: Permission denied in /opt/lampp/htdocs/drupal/sites/all/modules/civicrm/CRM/Utils/File.php on line 115.
    * warning: mkdir() [function.mkdir]: No such file or directory in /opt/lampp/htdocs/drupal/sites/all/modules/civicrm/CRM/Utils/File.php on line 115.
    * warning: mkdir() [function.mkdir]: No such file or directory in /opt/lampp/htdocs/drupal/sites/all/modules/civicrm/CRM/Utils/File.php on line 115.
    * warning: mkdir() [function.mkdir]: No such file or directory in /opt/lampp/htdocs/drupal/sites/all/modules/civicrm/CRM/Utils/File.php on line 115.

Can't seem to figure that part out...
« Last Edit: October 21, 2009, 12:21:38 pm by leupi »

Matt2000

  • I post frequently
  • ***
  • Posts: 288
  • Karma: 27
    • http://www.ninjitsuweb.com
Re: #1217 - Cannot delete or update a parent row: a foreign key constraint fails
October 21, 2009, 12:59:59 pm
from the mysql command line interface, enter

Code: [Select]
USE drupal;
where drupal = your drupal database name.

Otherwise, you can use the 'SQL' tab in phpmyadmin, once you've navigated to your drupal database.
Drupal/CiviCRM micro-blogging http://twitter.com/matt2000

Ninjitsu Web Development http://www.NinjitsuWeb.com/

8ballsaysiwin@gmail.com

  • Guest
Re: #1217 - Cannot delete or update a parent row: a foreign key constraint fails
October 21, 2009, 01:04:33 pm

Make sure to follow these instructions: http://wiki.civicrm.org/confluence/display/CRMDOC/Moving+an+Existing+Installation+to+a+New+Server+or+Location

leupi

  • I post frequently
  • ***
  • Posts: 192
  • Karma: 2
Re: #1217 - Cannot delete or update a parent row: a foreign key constraint fails
October 23, 2009, 08:34:53 am
Think that I figured it out. Me being database challenged, I did not realize that I could not import a database from a windows version of CiviCRM to a linux version. There was a line in the DB that had windows paths in it. I replaced that line with the appropriate linux paths and everything is working now. I appreciate all of the help. I now have this thing up and running, now without issues, but I'm getting there  :)

Todd

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • #1217 - Cannot delete or update a parent row: a foreign key constraint fails

This forum was archived on 2017-11-26.