Problem creating a user table in MYSQL

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Problem creating a user table in MYSQL
DirtySnipe
CZ Super Newbie
DirtySnipe has been a member for over 19 year's 19 Year Member
Occupation: Network Administrator
Gender: Male
Website:
Status: Offline
Joined: Feb 28, 2005
0.00 posts per day
Posts: 35
Points: 1,202
   
Im trying to create a user table with the following code but i get this error message can some tell me what is wrong.

create table users (id int(5) key auto_increment not null,
username varchar(30) not null,
password varchar(50) not null,
email varchar(80) DEFAULT "System",
accesslevel int(1) not null DEFAULT 1,
rank int(1) not null DEFAULT 1,
credit int(20) not null DEFAULT 0,
addedby int(5) not null DEFAULT 0,
lastlogin int(20) not null,
active bool not null DEFAULT true,
);

this is the 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 'key auto_increment not null,
username varchar(30) not nu

Im running mysql 4



Back to top Reply with quote
#2   re: Problem creating a user table in MYSQL
Dazed
CZ Newbie
Dazed has been a member for over 18 year's 18 Year Member
Gender: Male
Status: Offline
Joined: Mar 16, 2006
0.00 posts per day
Posts: 2
Points: 46
   
Try this:

create table users
(
id int(5) not null KEY auto_increment,
username varchar(30) not null,
password varchar(50) not null,
email varchar(80) DEFAULT 'System',
accesslevel int(1) not null DEFAULT '1',
rank int(1) not null DEFAULT '1',
credit int(20) not null DEFAULT '0',
addedby int(5) not null DEFAULT '0',
lastlogin int(20) not null,
active bool NOT NULL DEFAULT 'true'
)



Back to top Reply with quote
#3   re: Problem creating a user table in MYSQL
DirtySnipe
CZ Super Newbie
DirtySnipe has been a member for over 19 year's 19 Year Member
Occupation: Network Administrator
Gender: Male
Website:
Status: Offline
Joined: Feb 28, 2005
0.00 posts per day
Posts: 35
Points: 1,202
   
#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 'KEY auto_increment,
username varchar(30) not null,
password



Back to top Reply with quote
#4   Re: re: Problem creating a user table in MYSQL
Dazed
CZ Newbie
Dazed has been a member for over 18 year's 18 Year Member
Gender: Male
Status: Offline
Joined: Mar 16, 2006
0.00 posts per day
Posts: 2
Points: 46
   


Originally posted by DirtySnipe @ Fri Mar 17, 2006 9:14 pm:

#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 'KEY auto_increment,
username varchar(30) not null,
password


I think you are going to need to google that. I was able to run that query successfully from myadmin. Maybe you mysql version?



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum