why isnt this working

Discussion in 'MySQL' started by locals, Sep 3, 2007.

  1. #1
    CAN SOME ONE PLEASE HELP ME FIX THIS SO THAT I CAN UP LOAD THIS FILE ????

    Error
    SQL query:

    CREATE TABLE `articles` (

    `id` int( 10 ) NOT NULL AUTO_INCREMENT ,
    `own_id` bigint( 20 ) NOT NULL default '0',
    `title` varchar( 200 ) NOT NULL default '',
    `image` varchar( 200 ) NOT NULL default '',
    `leadin` longtext NOT NULL ,
    `text` longtext NOT NULL ,
    `category` int( 6 ) NOT NULL default '0',
    `date` bigint( 20 ) NOT NULL default '0',
    `verified` enum( '1', '0' ) NOT NULL default '0',
    PRIMARY KEY ( `id` ) ,
    KEY `own_id` ( `own_id` , `category` , `date` , `verified` )
    ) ENGINE = MYISAM DEFAULT CHARSET = latin1 AUTO_INCREMENT =33;



    MySQL said:

    #1064 - 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 'DEFAULT CHARSET=latin1 AUTO_INCREMENT=33' at line 13
     
    locals, Sep 3, 2007 IP
  2. netstratics

    netstratics Peon

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I ran it as a direct query in PHPMyAdmin and it worked for me. If you are attempting to import this query as a file then perhaps there is something funky in the file causing the problem. Otherwise, maybe some sort of problem due to you having a different version of MySQL than I do? I am not a MySQL expert but I thought this much might help.
     
    netstratics, Sep 3, 2007 IP
  3. locals

    locals Well-Known Member

    Messages:
    1,677
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    153
    #3
    did you run it under mysql5.0 or something ???
     
    locals, Sep 4, 2007 IP
  4. Kuldeep1952

    Kuldeep1952 Active Member

    Messages:
    290
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    60
    #4
    Run this before running the create query:

    DROP TABLE IF EXISTS `articles`;

    Also try removing the part AUTO_INCREMENT =33;
     
    Kuldeep1952, Sep 5, 2007 IP
  5. fabriciogr

    fabriciogr Active Member

    Messages:
    958
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    73
    #5
    it's most probably related to your database configuration such as charset and language config.. or maybe event database version conflict...

    try to run the script like this... it shouldn't give you any versioning problems


    CREATE TABLE `articles` (

    `id` int( 10 ) NOT NULL AUTO_INCREMENT ,
    `own_id` bigint( 20 ) NOT NULL default '0',
    `title` varchar( 200 ) NOT NULL default '',
    `image` varchar( 200 ) NOT NULL default '',
    `leadin` longtext NOT NULL ,
    `text` longtext NOT NULL ,
    `category` int( 6 ) NOT NULL default '0',
    `date` bigint( 20 ) NOT NULL default '0',
    `verified` enum( '1', '0' ) NOT NULL default '0',
    PRIMARY KEY ( `id` ) ,
    KEY `own_id` ( `own_id` , `category` , `date` , `verified` )
    ) ENGINE = MYISAM AUTO_INCREMENT =33;
     
    fabriciogr, Sep 9, 2007 IP