Closed Thread Icon

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

 
Hustluz
Bipolar (III) Inmate

From:
Insane since: Jun 2003

posted posted 12-15-2009 18:33

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

posted posted 12-16-2009 09:20

how are you calling this script?

Hustluz
Bipolar (III) Inmate

From:
Insane since: Jun 2003

posted posted 12-16-2009 12:23

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

posted posted 12-16-2009 15:27

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

posted posted 12-17-2009 05:33

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

posted posted 12-17-2009 05:39

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)

« BackwardsOnwards »

Show Forum Drop Down Menu