ktiwari
ktiwari

Reputation: 21

mySQL 5.5.43 syntax error

I am doing Mantis database upgrade and I am getting the below error when running the create table command. Can someone please help me to see whats wrong with the mysql syntax?

This is the error msg:

Schema CreateTableSQL ( )   BAD
CREATE TABLE (
email_id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
email VARCHAR(64) NOT NULL DEFAULT '',
subject VARCHAR(250) NOT NULL DEFAULT '', 
submitted DATETIME NOT NULL DEFAULT '1970-01-01 00:00:01',
metadata LONGTEXT NOT NULL,
body LONGTEXT NOT NULL,
PRIMARY KEY (email_id) )
ENGINE=MyISAM

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 '( email_id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, email ' at line 1

This is a part of the create table code in schema.php

$upgrade[] = Array('CreateTableSQL',Array(config_get('mantis_email_table'),"
email_id              I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
email                 C(64) NOTNULL DEFAULT \" '' \",
subject               C(250) NOTNULL DEFAULT \" '' \",
submitted     T NOTNULL DEFAULT '1970-01-01 00:00:01',
metadata              XL NOTNULL,
body                  XL NOTNULL
",Array('mysql' => 'ENGINE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

Upvotes: 0

Views: 336

Answers (2)

ktiwari
ktiwari

Reputation: 21

I found my solution. My server is running 5.5.43 mysql and the mantis install script was looking for 4.0.1 I commented out the create table commands for the 4 tables it was giving error for at the schema.php. I also commented out the check for the mysql ver 4.0.1. Bypassing these commands from the script enabled me to proceed with the installation.

Upvotes: 0

Paul Maxwell
Paul Maxwell

Reputation: 35593

You have not provided the table a name:

CREATE TABLE  # name is missing here

    ( email_id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT
    , email VARCHAR(64) NOT NULL DEFAULT ''
    , subject VARCHAR(250) NOT NULL DEFAULT ''
    , submitted DATETIME NOT NULL DEFAULT '1970-01-01 00:00:01'
    , metadata LONGTEXT NOT NULL
    , body LONGTEXT NOT NULL
    , PRIMARY KEY (email_id) 
)ENGINE=MyISAM

Upvotes: 2

Related Questions