Problem importing sql tables

Status
Not open for further replies.

Psoewish

New Member
Messages
80
Reaction score
0
Points
0
Hello, I'm currently installing an addon to my Dragonfly install (gave up on e107 as it had no good mods for guild management), and it requires me to import some tables into the sql database.

Now, it goes well the first few lines but then it spits out the following error:
Code:
[B]Error[/B]

     [B]SQL query:[/B]     
               CREATE  UNIQUE  INDEX gi_realm_name_idx ON guildinfo_chars(realm,
name
);

     
      [B]MySQL said: [/B] 
  #1071 - Specified key was too long; max key length is 1024 bytes

Now, does anybody have any suggestions on what I have to do to solve this matter? Obviously it's simply too long to import and it's only by a few chars because it manages to import a key which is a bit shorter.

Thanks in advance.

EDIT: WOW, I forgot to add my info to the post! I'm sorry, here is the info:

cPanel username: psoewish
subdomain: guildnoir.elementfx.com
 
Last edited by a moderator:

Psoewish

New Member
Messages
80
Reaction score
0
Points
0
Hmm now I have another problem, the headache from searching the answer :p

Needless to say, I didn't find anything in that thread you linked Corey, the person has the same problem as me, but nobody gives a clear answer as to what to do to solve it ...

So I looked a bit further now knowing that it has something to do with changing the size of colums, but I have totally no idea what it's all about actually :(

I'm really stuck now, been looking around http://dev.mysql.com/doc/refman/5.0/en/charset.html for the past 30 minutes or so as well but that' where the headache came from :p

EDIT: ok I've done some more research and I might found what you mean by that.
The original code is:

Code:
CREATE TABLE `guildinfo_chars` (
  `id` int(15) NOT NULL auto_increment,
  `user_id` int(15),
  `realm` varchar(250) NOT NULL,
  `name` varchar(250) NOT NULL,
  `type` varchar(50) NOT NULL,
  `race` varchar(50),
  `class` varchar(50),
  `level` int(15),
  `note` varchar(250),
  `zone_id` int(5),
  `sex` varchar(10),
  `guild` varchar(250),
  PRIMARY KEY  (`id`),
  index gi_u_zone_id_idx (zone_id),
  foreign key (zone_id) references guildinfo_zones(zone_id)
) TYPE=InnoDB AUTO_INCREMENT=1;
create unique index gi_realm_name_idx ON guildinfo_chars (realm,name);

Now if I changed some stuff so that it looks like this:

Code:
CREATE TABLE `guildinfo_chars` (
  `id` int(15) NOT NULL auto_increment,
  `user_id` int(15),
  `realm` varchar(200) NOT NULL,
  `name` varchar(200) NOT NULL,
  `type` varchar(50) NOT NULL,
  `race` varchar(50),
  `class` varchar(50),
  `level` int(15),
  `note` varchar(200),
  `zone_id` int(5),
  `sex` varchar(10),
  `guild` varchar(200),
  PRIMARY KEY  (`id`),
  index gi_u_zone_id_idx (zone_id),
  foreign key (zone_id) references guildinfo_zones(zone_id)
) TYPE=InnoDB AUTO_INCREMENT=1;
create unique index gi_realm_name_idx ON guildinfo_chars (realm,name);

Would this work without screwing up the table? This would total 995 bytes.

Now while I was typing this, I tried it as well and it still spits out the same error, then I saw somewhere that utf8 character set uses 3b per letter. So what should I do now? I mean, that's a very drastic change I'd have to make then ...

EDIT2: allright, time for some math. I just realized I could of course just do some changes that could work without screwing it up. For example
Code:
  `guild` varchar(200),
Our guild is a pretty standard name I guess, and everybody who will be in there will of course have the same guild so I could narrow that down allready, also I know the name of our realm and so on and so on. Allright I think I'm onto something + I learnt a lot about MySQL today (if all i'm saying here is correct that is, only 1 way to find out! :D)
Edit:
Aha, I've amazed myself today :p
It passed through the check, now it's tuck on another part with the same error but at least I know it works now!!!

Now I just hope I've set it to some decent values in there so I don't get Guild Noi everywhere as guild xD (would be a matter of fiddling around with the tables though.
 
Last edited:

Corey

I Break Things
Staff member
Messages
34,553
Reaction score
204
Points
63
Okay, sounds like you've made it through your issue. If you need further help from us please re-open this.

Good job on the research ;)

-Corey
 
Status
Not open for further replies.
Top