MySQL syntax error I don't understand [duplicate] - mysql

This question already has answers here:
1064 error in CREATE TABLE ... TYPE=MYISAM
(5 answers)
Closed 9 years ago.
MySQL generated by a dump of a v3.23.58 database:
DROP TABLE IF EXISTS `article`;
CREATE TABLE `article` (
`DATE` date NOT NULL default '0000-00-00',
`SECTION_ID` smallint(6) NOT NULL default '0',
`PRIORITY` int(11) NOT NULL default '0',
`AUTHOR1` int(100) NOT NULL default '1',
`AUTHOR2` varchar(100) NOT NULL default '',
`AUTHOR3` varchar(100) NOT NULL default '',
`AUTHOR4` varchar(100) NOT NULL default '',
`AUTHOR5` varchar(100) NOT NULL default '',
`AUTHOR6` int(100) NOT NULL default '0',
`AUTHOR7` int(100) NOT NULL default '0',
`AUTHOR8` int(100) NOT NULL default '0',
`AUTHOR9` int(100) NOT NULL default '0',
`AUTHOR10` int(100) NOT NULL default '0',
`AUTHOR_JOB` int(11) NOT NULL default '0',
`TITLE` varchar(100) NOT NULL default '',
`SUBHEAD` varchar(200) NOT NULL default '',
`TEXT` text NOT NULL,
`PULLQUOTE` text NOT NULL,
`SERIES` int(10) unsigned zerofill NOT NULL default '0000000000',
`TYPE` int(10) unsigned zerofill NOT NULL default '0000000000',
`VIEWS` int(10) unsigned zerofill NOT NULL default '0000000000',
`EMAILS` int(10) unsigned zerofill NOT NULL default '0000000000',
`BACKUPTEXT` text NOT NULL,
`BOWDOIN_VIEWS` int(10) unsigned zerofill NOT NULL default '0000000000',
PRIMARY KEY (`DATE`,`SECTION_ID`,`PRIORITY`),
FULLTEXT KEY `article_full_text` (`TITLE`,`TEXT`)
) TYPE=MyISAM;
Attempting to import it into a v5.5.19 database, I get this error:
[ERROR in query 2] 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 'TYPE=MyISAM' at line 28
I've tried deconstructing it to a very basis skeleton but still get the error. Ought to be an obvious mistake if you have the eye for it.

Your version of MySQL probably requires that you edit query
replace
TYPE=MyISAM
with
ENGINE=MyISAM
if you are importing from script file then just:
Open script file
Find TYPE=MyISAM
Replace with ENGINE=MyISAM
save
Then try .

change last line
) TYPE=MyISAM;
to
) ENGINE=MyISAM
so all would be
DROP TABLE IF EXISTS `article`;
CREATE TABLE `article` (
`DATE` date NOT NULL default '0000-00-00',
`SECTION_ID` smallint(6) NOT NULL default '0',
`PRIORITY` int(11) NOT NULL default '0',
`AUTHOR1` int(100) NOT NULL default '1',
`AUTHOR2` varchar(100) NOT NULL default '',
`AUTHOR3` varchar(100) NOT NULL default '',
`AUTHOR4` varchar(100) NOT NULL default '',
`AUTHOR5` varchar(100) NOT NULL default '',
`AUTHOR6` int(100) NOT NULL default '0',
`AUTHOR7` int(100) NOT NULL default '0',
`AUTHOR8` int(100) NOT NULL default '0',
`AUTHOR9` int(100) NOT NULL default '0',
`AUTHOR10` int(100) NOT NULL default '0',
`AUTHOR_JOB` int(11) NOT NULL default '0',
`TITLE` varchar(100) NOT NULL default '',
`SUBHEAD` varchar(200) NOT NULL default '',
`TEXT` text NOT NULL,
`PULLQUOTE` text NOT NULL,
`SERIES` int(10) unsigned zerofill NOT NULL default '0000000000',
`TYPE` int(10) unsigned zerofill NOT NULL default '0000000000',
`VIEWS` int(10) unsigned zerofill NOT NULL default '0000000000',
`EMAILS` int(10) unsigned zerofill NOT NULL default '0000000000',
`BACKUPTEXT` text NOT NULL,
`BOWDOIN_VIEWS` int(10) unsigned zerofill NOT NULL default '0000000000',
PRIMARY KEY (`DATE`,`SECTION_ID`,`PRIORITY`),
FULLTEXT KEY `article_full_text` (`TITLE`,`TEXT`)
) ENGINE=MyISAM;

Related

Error in MySQL database code while importing

my code :
CREATE TABLE IF NOT EXISTS `friends` (
`Id` INT(10) NOT NULL AUTO_INCREMENT,
`providerid` INT(10) NOT NULL AUTO_INCREMENT,
`requestid` INT(10) NOT NULL AUTO_INCREMENT,
`status` BINARY(1) NOT NULL,
PRIMARY KEY (`Id`)
);
CREATE TABLE IF NOT EXISTS `messages` (
`Id` INT(255) NOT NULL AUTO_INCREMENT,
`fromuid` INT(255) NOT NULL,
`touid` INT(255) NOT NULL,
`sentdt` DATETIME NOT NULL,
`read` TINYINT(1) NOT NULL DEFAULT '0',
`readdt` DATETIME DEFAULT NULL,
`messagetext` LONGTEXT CHARACTER SET utf8 NOT NULL,
PRIMARY KEY (`Id`)
);
CREATE TABLE IF NOT EXISTS `users` (
`Id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`username` VARCHAR(45) NOT NULL DEFAULT '',
`password` VARCHAR(32) NOT NULL DEFAULT '',
`email` VARCHAR(45) NOT NULL DEFAULT '',
`date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`status` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`authenticationTime` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`userKey` VARCHAR(32) NOT NULL DEFAULT '',
`IP` VARCHAR(45) NOT NULL DEFAULT '',
`port` INT(10) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`Id`)
);
error : #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 'CREATE TABLE IF NOT EXISTS messages (
Id int(255) NOT NULL AUTO_INCREMENT,' at line 8
so plz help me correcting the code...
Thank you
There are few errors in your script.
1) there can be only one autoincrement key and it must be defined as a key
2) spelling mistable in third query of DEFAULT in
`email` varchar(45) NOT NULL DEFAULT '',
3) DEFAULT keyword used twice in 3rd query for below field and missing NULL for NOT NULL
`authenticationTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
CORRECT query:-
CREATE TABLE IF NOT EXISTS `friends` (
`Id` int(10) NOT NULL AUTO_INCREMENT,
`providerid` int(10) NOT NULL ,
`requestid` int(10) NOT NULL ,
`status` binary(1) NOT NULL ,
PRIMARY KEY (`Id`));
CREATE TABLE IF NOT EXISTS `messages` (
`Id` int(255) NOT NULL AUTO_INCREMENT,
`fromuid` int(255) NOT NULL,
`touid` int(255) NOT NULL,
`sentdt` datetime NOT NULL,
`read` tinyint(1) NOT NULL DEFAULT '0',
`readdt` datetime DEFAULT NULL,
`messagetext` longtext CHARACTER SET utf8 NOT NULL ,
PRIMARY KEY (`Id`)
);
CREATE TABLE IF NOT EXISTS `users` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(45) NOT NULL DEFAULT '',
`password` varchar(32) NOT NULL DEFAULT '',
`email` varchar(45) NOT NULL DEFAULT '',
`date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`status` tinyint(3) unsigned NOT NULL DEFAULT '0',
`authenticationTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`userKey` varchar(32) NOT NULL DEFAULT '',
`IP` varchar(45) NOT NULL DEFAULT '',
`port` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`Id`)
)

Innodb. Error Code: 1191. Can't find FULLTEXT index matching the column list

After migrating from myiasm to innodb the following query fails unexpectedly
SELECT postid, post.dateline
FROM post AS post USE INDEX (threadid)
INNER JOIN thread AS thread ON(thread.threadid = post.threadid)
WHERE MATCH(post.title, post.pagetext) AGAINST ('+match1 +match2' IN BOOLEAN MODE) AND thread.threadid = <my_id>;
If I remove USE INDEX (threadid) the query works
If I instead remove MATCH(post.title, post.pagetext) AGAINST ('+match1 +match2' IN BOOLEAN MODE) AND the query also works.
I am using version 5.6.19-log
Relevant portions of schema:
CREATE TABLE `post` (
`postid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`threadid` int(10) unsigned NOT NULL DEFAULT '0',
`username` varchar(100) NOT NULL DEFAULT '',
`userid` int(10) unsigned NOT NULL DEFAULT '0',
`title` varchar(250) NOT NULL DEFAULT '',
`dateline` int(10) unsigned NOT NULL DEFAULT '0',
`pagetext` mediumtext NOT NULL,
`allowsmilie` smallint(6) NOT NULL DEFAULT '0',
`showsignature` smallint(6) NOT NULL DEFAULT '0',
`ipaddress` varchar(16) NOT NULL DEFAULT '',
`iconid` smallint(5) unsigned NOT NULL DEFAULT '0',
`visible` smallint(6) NOT NULL DEFAULT '0',
`parentid` int(10) unsigned NOT NULL DEFAULT '0',
`attach` smallint(5) unsigned NOT NULL DEFAULT '0',
`infraction` smallint(5) unsigned NOT NULL DEFAULT '0',
`reportthreadid` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`postid`),
KEY `userid` (`userid`),
KEY `threadid` (`threadid`,`userid`),
FULLTEXT KEY `title` (`title`,`pagetext`)
)
CREATE TABLE `thread` (
`threadid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(250) NOT NULL DEFAULT '',
`lastpost` int(10) unsigned NOT NULL DEFAULT '0',
`forumid` smallint(5) unsigned NOT NULL DEFAULT '0',
`pollid` int(10) unsigned NOT NULL DEFAULT '0',
`open` tinyint(4) NOT NULL DEFAULT '0',
`replycount` int(10) unsigned NOT NULL DEFAULT '0',
`postusername` varchar(100) NOT NULL DEFAULT '',
`postuserid` int(10) unsigned NOT NULL DEFAULT '0',
`lastposter` varchar(100) NOT NULL DEFAULT '',
`dateline` int(10) unsigned NOT NULL DEFAULT '0',
`views` int(10) unsigned NOT NULL DEFAULT '0',
`iconid` smallint(5) unsigned NOT NULL DEFAULT '0',
`notes` varchar(250) NOT NULL DEFAULT '',
`visible` smallint(6) NOT NULL DEFAULT '0',
`sticky` smallint(6) NOT NULL DEFAULT '0',
`votenum` smallint(5) unsigned NOT NULL DEFAULT '0',
`votetotal` smallint(5) unsigned NOT NULL DEFAULT '0',
`attach` smallint(5) unsigned NOT NULL DEFAULT '0',
`firstpostid` int(10) unsigned NOT NULL DEFAULT '0',
`similar` varchar(55) NOT NULL DEFAULT '',
`hiddencount` int(10) unsigned NOT NULL DEFAULT '0',
`deletedcount` smallint(5) unsigned NOT NULL DEFAULT '0',
`lastpostid` int(10) unsigned NOT NULL DEFAULT '0',
`prefixid` varchar(25) NOT NULL DEFAULT '',
`taglist` mediumtext,
PRIMARY KEY (`threadid`),
KEY `forumid` (`forumid`,`visible`,`sticky`,`lastpost`),
KEY `postuserid` (`postuserid`),
KEY `postuserid_2` (`postuserid`),
KEY `pollid` (`pollid`),
KEY `lastpost` (`lastpost`,`forumid`),
KEY `dateline` (`dateline`),
KEY `prefixid` (`prefixid`,`forumid`),
FULLTEXT KEY `title` (`title`)
)
Could this be a bug in innodb?
Dropping USE INDEX (threadid) would not matter I guess, the query planner is smart enough

InnoDB, how to detect the index types?

I have a table:
CREATE TABLE `posts` (
`post_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`topic_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
`forum_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
`poster_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
`icon_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
`poster_ip` varchar(40) COLLATE utf8_bin NOT NULL DEFAULT '',
`post_time` int(11) unsigned NOT NULL DEFAULT '0',
`post_approved` tinyint(1) unsigned NOT NULL DEFAULT '1',
`post_reported` tinyint(1) unsigned NOT NULL DEFAULT '0',
`enable_bbcode` tinyint(1) unsigned NOT NULL DEFAULT '1',
`enable_smilies` tinyint(1) unsigned NOT NULL DEFAULT '1',
`enable_magic_url` tinyint(1) unsigned NOT NULL DEFAULT '1',
`enable_sig` tinyint(1) unsigned NOT NULL DEFAULT '1',
`post_username` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
`post_subject` blob,
`post_text` mediumtext COLLATE utf8_bin NOT NULL,
`post_checksum` varchar(32) COLLATE utf8_bin NOT NULL DEFAULT '',
`post_attachment` tinyint(1) unsigned NOT NULL DEFAULT '0',
`bbcode_bitfield` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
`bbcode_uid` varchar(8) COLLATE utf8_bin NOT NULL DEFAULT '',
`post_postcount` tinyint(1) unsigned NOT NULL DEFAULT '1',
`post_edit_time` int(11) unsigned NOT NULL DEFAULT '0',
`post_edit_reason` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
`post_edit_user` mediumint(8) unsigned NOT NULL DEFAULT '0',
`post_edit_count` smallint(4) unsigned NOT NULL DEFAULT '0',
`post_edit_locked` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`post_id`),
KEY `forum_id` (`forum_id`),
KEY `topic_id` (`topic_id`),
KEY `poster_ip` (`poster_ip`),
KEY `poster_id` (`poster_id`),
KEY `post_approved` (`post_approved`),
KEY `post_username` (`post_username`),
KEY `tid_post_time` (`topic_id`,`post_time`) USING HASH
) ENGINE=InnoDB AUTO_INCREMENT=22381 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
as you can see, the last index is "USING HASH" - but when I use show indexes from posts;, thats not showing it
After a quick Google search, I quickly found that InnoDB doesn't support HASH indexes, but still accepts the modifier in table definitions.
SHOW CREATE TABLE may show USING HASH, but SHOW INDEXES will actually show you what index type is being used:
Index_type
The index method used (BTREE, FULLTEXT, HASH, RTREE).

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
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 ''Ïðèçûâíèê',
description varchar(1000) DEFAULT 'Îïèñàíèå ïåðñîíàæà îòñóòñòâ' at line 64
CREATE TABLE IF NOT EXISTS users (
id_user int(20) unsigned NOT NULL AUTO_INCREMENT,
name varchar(32) DEFAULT NULL,
pass varchar(32) DEFAULT NULL,
email varchar(64) NOT NULL,
ip varchar(20) NOT NULL,
last_ip varchar(20) NOT NULL,
last_time int(11) NOT NULL DEFAULT '0',
ban int(20) NOT NULL DEFAULT '0',
race int(1) NOT NULL,
gender int(1) NOT NULL DEFAULT '1',
ava1 varchar(100) NOT NULL,
ava2 varchar(100) NOT NULL,
ava3 varchar(100) NOT NULL,
token varchar(32) NOT NULL,
gold int(11) NOT NULL DEFAULT '50',
krystal int(11) NOT NULL DEFAULT '0',
zelen int(11) NOT NULL DEFAULT '0',
hp int(11) NOT NULL DEFAULT '100',
exp int(11) NOT NULL DEFAULT '0',
hp_now int(11) NOT NULL DEFAULT '100',
power int(11) NOT NULL DEFAULT '5',
def int(11) NOT NULL DEFAULT '5',
ability int(11) NOT NULL DEFAULT '5',
mass int(11) NOT NULL DEFAULT '5',
skill int(11) NOT NULL DEFAULT '5',
glory int(11) NOT NULL DEFAULT '0',
ref int(11) NOT NULL DEFAULT '0',
battle int(11) NOT NULL DEFAULT '0',
win int(11) NOT NULL DEFAULT '0',
loot int(11) NOT NULL DEFAULT '0',
lost int(11) NOT NULL DEFAULT '0',
damage int(11) NOT NULL DEFAULT '0',
pet int(20) NOT NULL DEFAULT '0',
safe int(11) NOT NULL DEFAULT '0',
safe2 int(11) NOT NULL DEFAULT '0',
safe3 int(11) NOT NULL DEFAULT '0',
safe4 int(11) NOT NULL DEFAULT '0',
woodoo int(11) NOT NULL DEFAULT '0',
woodoo2 int(11) NOT NULL DEFAULT '0',
woodoo3 int(11) NOT NULL DEFAULT '0',
woodoo4 int(11) NOT NULL DEFAULT '0',
house int(11) NOT NULL DEFAULT '0',
cage int(11) NOT NULL DEFAULT '0',
fence int(11) NOT NULL DEFAULT '0',
road int(11) NOT NULL DEFAULT '0',
out int(11) NOT NULL DEFAULT '0',
plant int(11) NOT NULL DEFAULT '0',
time_dozor int(11) NOT NULL DEFAULT '120',
vip int(20) NOT NULL DEFAULT '0',
last_bat int(11) NOT NULL DEFAULT '0',
clan int(11) NOT NULL DEFAULT '0',
clan_stat varchar(64) NOT NULL 'Призывник',
description varchar(1000) DEFAULT 'Описание персонажа отсутствует',
att_description varchar(500) NOT NULL DEFAULT 'Сообщение отсутствует',
bat_timer int(11) NOT NULL DEFAULT '0',
authlevel int(2) NOT NULL DEFAULT '0',
helmet int(20) NOT NULL DEFAULT '0',
necklet int(20) NOT NULL DEFAULT '0',
weapon int(20) NOT NULL DEFAULT '0',
shield int(20) NOT NULL DEFAULT '0',
armor int(20) NOT NULL DEFAULT '0',
read_msg int(1) NOT NULL DEFAULT '1',
kosti_g int(11) NOT NULL DEFAULT '0',
kosti_k int(11) NOT NULL DEFAULT '0',
kosti_g_stat int(11) NOT NULL DEFAULT '0',
kosti_k_stat int(11) NOT NULL DEFAULT '0',
kosti_z_stat int(11) NOT NULL DEFAULT '0',
kosti_win int(11) NOT NULL DEFAULT '0',
kosti_lose int(11) NOT NULL DEFAULT '0',
naper_g int(11) NOT NULL DEFAULT '0',
naper_k int(11) NOT NULL DEFAULT '0',
recd_naper_g_stat int(11) NOT NULL DEFAULT '0',
recd_naper_k_stat int(11) NOT NULL DEFAULT '0',
recd_naper_z_stat int(11) NOT NULL DEFAULT '0',
spend_naper_g_stat int(11) NOT NULL DEFAULT '0',
spend_naper_k_stat int(11) NOT NULL DEFAULT '0',
spend_naper_z_stat int(11) NOT NULL DEFAULT '0',
naper_win int(11) NOT NULL DEFAULT '0',
naper_lose int(11) NOT NULL DEFAULT '0',
mmine int(11) NOT NULL DEFAULT '0',
msglade int(11) NOT NULL DEFAULT '0',
mbglade int(11) NOT NULL DEFAULT '0',
mpick int(11) NOT NULL DEFAULT '0',
mglass int(11) NOT NULL DEFAULT '0',
mhelmet int(11) NOT NULL DEFAULT '0',
mpicks int(11) NOT NULL DEFAULT '0',
mglasss int(11) NOT NULL DEFAULT '0',
mhelmets int(11) NOT NULL DEFAULT '0',
mflash int(11) NOT NULL DEFAULT '0',
mpow int(11) NOT NULL DEFAULT '0',
mdef int(11) NOT NULL DEFAULT '0',
mabi int(11) NOT NULL DEFAULT '0',
mskil int(11) NOT NULL DEFAULT '0',
mwork int(11) NOT NULL DEFAULT '0',
mper int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (id_user)
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 ;
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 'N'Ïðèçûâíèê',
description varchar(1000) CHARACTER SET utf8 NOT NULL DEFAULT' at line 64
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 'NOT NULL,
ip varchar(20) DEFAULT NOT NULL,
last_ip varchar(20) CHARACT' at line 16
1067 - Invalid default value for 'clan_stat'
Try specifying a character set:
description varchar(1000) CHARACTER SET utf8 DEFAULT 'Описание персонажа отсутствует',
I'm going off of this example from the MySQL documentaion:
11.1.3. String Type Overview
CREATE TABLE t
(
c1 VARCHAR(20) CHARACTER SET utf8,
c2 TEXT CHARACTER SET latin1 COLLATE latin1_general_cs
);
As far as I know, you'll have to set that for each of your varchar columns.
Here's an example SQLFiddle showing this in action: http://sqlfiddle.com/#!2/e4cc6/1
Alternatively, you might just be able to prefix your string with N:
description varchar(1000) DEFAULT N'Описание персонажа отсутствует'
And here's an example of that: http://sqlfiddle.com/#!2/e6658/1

MySQL foreign key to another foreign key

The idea is quite simple: i have three (or more) tables
- master_tbl (id, something, somethingelse)
- tbl2 (id, ....)
- tbl3 (id, ....)
Now what i want is a foreign key relationship, such as tbl3.id would point to tbl2.id and tbl2.id would point to master_tbl.id - all foreign keys are ON UPDATE CASCADE and ON DELETE CASCADE. What I'll get from this is that when I delete a record from tbl2, its tbl3 equivalent will get erased as well, but not master_tbl. When I delete a record from master_tbl, all three tables get erased.
When I try to create the foreign key on tbl3.id->tbl2.id, I get mysql error 150 - can't create table (the tbl2.id->master_tbl.id is already created).
My MySQL version is 5.1.46. Any ideas why this might be?
EDIT: table definitions
smf_members aka master_table
-- Table "smf_members" DDL
CREATE TABLE `smf_members` (
`id_member` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`member_name` varchar(80) NOT NULL DEFAULT '',
`date_registered` int(10) unsigned NOT NULL DEFAULT '0',
`posts` mediumint(8) unsigned NOT NULL DEFAULT '0',
`id_group` smallint(5) unsigned NOT NULL DEFAULT '0',
`lngfile` varchar(255) NOT NULL DEFAULT '',
`last_login` int(10) unsigned NOT NULL DEFAULT '0',
`real_name` varchar(255) NOT NULL DEFAULT '',
`instant_messages` smallint(5) NOT NULL DEFAULT '0',
`unread_messages` smallint(5) NOT NULL DEFAULT '0',
`new_pm` tinyint(3) unsigned NOT NULL DEFAULT '0',
`buddy_list` text NOT NULL,
`pm_ignore_list` varchar(255) NOT NULL DEFAULT '',
`pm_prefs` mediumint(8) NOT NULL DEFAULT '0',
`mod_prefs` varchar(20) NOT NULL DEFAULT '',
`message_labels` text NOT NULL,
`passwd` varchar(64) NOT NULL DEFAULT '',
`openid_uri` text NOT NULL,
`email_address` varchar(255) NOT NULL DEFAULT '',
`personal_text` varchar(255) NOT NULL DEFAULT '',
`gender` tinyint(4) unsigned NOT NULL DEFAULT '0',
`birthdate` date NOT NULL DEFAULT '0001-01-01',
`website_title` varchar(255) NOT NULL DEFAULT '',
`website_url` varchar(255) NOT NULL DEFAULT '',
`location` varchar(255) NOT NULL DEFAULT '',
`icq` varchar(255) NOT NULL DEFAULT '',
`aim` varchar(255) NOT NULL DEFAULT '',
`yim` varchar(32) NOT NULL DEFAULT '',
`msn` varchar(255) NOT NULL DEFAULT '',
`hide_email` tinyint(4) NOT NULL DEFAULT '0',
`show_online` tinyint(4) NOT NULL DEFAULT '1',
`time_format` varchar(80) NOT NULL DEFAULT '',
`signature` text NOT NULL,
`time_offset` float NOT NULL DEFAULT '0',
`avatar` varchar(255) NOT NULL DEFAULT '',
`pm_email_notify` tinyint(4) NOT NULL DEFAULT '0',
`karma_bad` smallint(5) unsigned NOT NULL DEFAULT '0',
`karma_good` smallint(5) unsigned NOT NULL DEFAULT '0',
`usertitle` varchar(255) NOT NULL DEFAULT '',
`notify_announcements` tinyint(4) NOT NULL DEFAULT '1',
`notify_regularity` tinyint(4) NOT NULL DEFAULT '1',
`notify_send_body` tinyint(4) NOT NULL DEFAULT '0',
`notify_types` tinyint(4) NOT NULL DEFAULT '2',
`member_ip` varchar(255) NOT NULL DEFAULT '',
`member_ip2` varchar(255) NOT NULL DEFAULT '',
`secret_question` varchar(255) NOT NULL DEFAULT '',
`secret_answer` varchar(64) NOT NULL DEFAULT '',
`id_theme` tinyint(4) unsigned NOT NULL DEFAULT '0',
`is_activated` tinyint(3) unsigned NOT NULL DEFAULT '1',
`validation_code` varchar(10) NOT NULL DEFAULT '',
`id_msg_last_visit` int(10) unsigned NOT NULL DEFAULT '0',
`additional_groups` varchar(255) NOT NULL DEFAULT '',
`smiley_set` varchar(48) NOT NULL DEFAULT '',
`id_post_group` smallint(5) unsigned NOT NULL DEFAULT '0',
`total_time_logged_in` int(10) unsigned NOT NULL DEFAULT '0',
`password_salt` varchar(255) NOT NULL DEFAULT '',
`ignore_boards` text NOT NULL,
`warning` tinyint(4) NOT NULL DEFAULT '0',
`passwd_flood` varchar(12) NOT NULL DEFAULT '',
`pm_receive_from` tinyint(4) unsigned NOT NULL DEFAULT '1',
PRIMARY KEY (`id_member`),
KEY `member_name` (`member_name`),
KEY `real_name` (`real_name`),
KEY `date_registered` (`date_registered`),
KEY `id_group` (`id_group`),
KEY `birthdate` (`birthdate`),
KEY `posts` (`posts`),
KEY `last_login` (`last_login`),
KEY `lngfile` (`lngfile`(30)),
KEY `id_post_group` (`id_post_group`),
KEY `warning` (`warning`),
KEY `total_time_logged_in` (`total_time_logged_in`),
KEY `id_theme` (`id_theme`)
) ENGINE=InnoDB AUTO_INCREMENT=73 DEFAULT CHARSET=utf8;
cyp_users aka tbl2
-- Table "cyp_users" DDL
CREATE TABLE `cyp_users` (
`id` mediumint(8) unsigned NOT NULL,
`role` varchar(255) NOT NULL DEFAULT 'unregistered',
PRIMARY KEY (`id`),
CONSTRAINT `cyp_users_ibfk_1` FOREIGN KEY (`id`) REFERENCES `smf_members` (`id_member`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
cyp_vip_users aka tbl3
-- Table "cyp_vip_users" DDL
CREATE TABLE `cyp_vip_users` (
`id` mediumint(8) NOT NULL,
`od` date NOT NULL,
`do` date NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
The ID's of tbl2 and tbl3 are different types.
Foreign Keys need to be of the same type.
tbl2.ID is UNSIGNED
tbl3.ID is SIGNED