Jump to content
X2Community Forums

Foreign key constraint is incorrectly formed


Recommended Posts

I manage my own server.

 

Help, I deleted my SQL databases twice, and every test passed before I tried to install short of the SSH2 extension, which I didn't know how to install.

 

Error installing module "users". SQL statement "ALTER TABLE `x2_calendar_permissions` ADD CONSTRAI..." failed;HY000,1005,Can't create table `sunshinb_crmx2`.`#sql-82c_1c3acd` (errno: 150 "Foreign key constraint is incorrectly formed")

 

Help!!

 

http://sunshinebabysitting.com/x2crm/install.php

 

Link to post
Share on other sites

This may be due to the default table engine in use on your server. If the default storage engine is set to MyISAM, then the x2_users table may not be created using InnoDB, which is required for foreign keys. To resolve, you can either update your default storage engine, or modify the users table SQL to explicitly use InnoDB.

 

To set the default engine, modify your my.cnf and add:

[mysqld]
default-storage-engine = innodb

To update the table definition, update protected/modules/users/data/install.sql and alter the end of the CREATE TABLE x2_users to read:

CREATE TABLE x2_users (
    // ...
) ENGINE InnoDB, COLLATE = utf8_general_ci;

before rerunning the installer.

 

Also, to get the SSH2 extension installed, you can install the php5-ssh2 and libssh2 packages if you're on Debian/Ubuntu Linux.

Link to post
Share on other sites
  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...