Topic: MySQL Foreign_key_checks Error message (Page 1 of 1) Pages that link to <a href="http://ozoneasylum.com/backlink?for=31537" title="Pages that link to Topic: MySQL Foreign_key_checks Error message (Page 1 of 1)" rel="nofollow" >Topic: MySQL Foreign_key_checks Error message <span class="small">(Page 1 of 1)</span>\

 
Hustluz
Bipolar (III) Inmate

From:
Insane since: Jun 2003

IP logged posted posted 12-15-2009 18:33 Edit Quote

Please help i thank you in advace

Problem:

Im getting an error message when i try to create this table from a sql script


Error:
>[Error] Script lines: 1-16 -------------------------
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET FOREIGN_KEY_CHECK=0;
DROP TABLE IF EXISTS comments;
CREATE TABLE comments (
' at line 2 


Script:

code:
USE database_name;
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS comments;
CREATE TABLE comments (
    id int(11) unsigned NOT NULL auto_increment,
    photograph_id int(11) unsigned NOT NULL,
    created datetime NOT NULL,
    author varchar(255) NOT NULL,
    body text NOT NULL,
    PRIMARY KEY (id),
    INDEX (photograph_id),
    FOREIGN KEY (photograph_id)
    REFERENCES photographs(id)
) ENGINE=InnoDB;
SET FOREIGN_KEY_CHECKS = 1;



I would be very greatful if someone would give me some insight as to what i am doing wrong

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 12-16-2009 09:20 Edit Quote

how are you calling this script?

Hustluz
Bipolar (III) Inmate

From:
Insane since: Jun 2003

IP logged posted posted 12-16-2009 12:23 Edit Quote

I use aqua data studio to call the script and create the database

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 12-16-2009 15:27 Edit Quote

So I'd start separating it into the actual calls, see which one is the culprit - perhaps your aqua data studio only takes one statement per call?

Hustluz
Bipolar (III) Inmate

From:
Insane since: Jun 2003

IP logged posted posted 12-17-2009 05:33 Edit Quote

No thats not it it worked fine when i had windows. Now that i have bought a new mac it seems not to be working. all i did was use the same scripts saved from windows

Hustluz
Bipolar (III) Inmate

From:
Insane since: Jun 2003

IP logged posted posted 12-17-2009 05:39 Edit Quote

Never mind Tyberius Prime i figured it out. the program wasn't set to use the ";" as the statement delimited so i changed it in the preferences and it worked just fine

Thank you for your help

(Edited by Hustluz on 12-17-2009 05:45)



Post Reply
 
Your User Name:
Your Password:
Login Options: Remember Me On This Computer
 
Your Text:
Loading...
Options: Show Signature
Enable Slimies
Enable Linkwords

« BackwardsOnwards »

Show Forum Drop Down Menu