Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 10-10-2011, 05:18 PM   #1
Registered: Dec 2008
Location: Norway
Distribution: Debian
Posts: 43

Rep: Reputation: 15
mySQL Foreign key that will not be constrained

I realize that linuxquestions might be the wrong place to ask this question but I will try anyway.

I am making a simple database that will be populated with data from a perl script. The tables are created and they work fine unless for one thing. I can create rows in the url table with nickids that does not exist in people even though I use the constraint attribute. Anyone have an ide why this is so?

*edit* I pasted a new version of the original code that will not be lost after a couple of days *edit*

PS, I wrote this by hand so there might be writing errors in the code.

Last edited by Mogget; 10-11-2011 at 06:03 AM.
Old 10-11-2011, 06:01 AM   #2
Registered: Dec 2008
Location: Norway
Distribution: Debian
Posts: 43

Original Poster
Rep: Reputation: 15
I just found the solution together with some of my classmates. It seems mySQL does not support foreign keys by default so you have to use innodb. You do that by adding the line ENGINE=InnoDB at the end of each table creation.

Here is a complete copy of the changes.


database, databases, debian, mysql, perl

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL - Foreign key failure - but the problem is with Eclipse, I think... nbcohen Linux - Server 2 05-04-2011 08:00 AM
[SOLVED] What are the key stroke combinations for foreign language accents in Office? Flackbait Linux - Newbie 2 04-13-2010 11:55 AM
sql foreign key constraint fails kpachopoulos Programming 2 02-17-2009 06:49 PM
Mysql foreign key doesn't allow update mohtasham1983 Programming 3 07-25-2008 10:56 PM
Mysql Foreign Key munna_502 Linux - Software 0 06-12-2004 04:31 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:20 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration