0

I've read thoroughly all the other questions/answers on this error before posting.

I am getting the above error for the following query:

    CREATE TABLE IF NOT EXISTS `userdata` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(255) NOT NULL,
  `email` varchar(500) NOT NULL,
  `password` varchar(500) NOT NULL,
  `firstname` varchar(5000) NOT NULL,
  `profile` text NOT NULL,
  `lastname` varchar(500) NOT NULL,
  `address` varchar(5000) NOT NULL,
  `bio` varchar(5000) NOT NULL,
  `state` varchar(500) NOT NULL,
  `city` varchar(500) NOT NULL,
  `zipcode` int(11) NOT NULL,
  `country` varchar(500) NOT NULL,
  `mobile` varchar(5000) NOT NULL,
  `status` varchar(5000) NOT NULL,
  `type` varchar(5000) NOT NULL,
  `adbalance` varchar(500) NOT NULL,
  `pubalance` varchar(500) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `email` (`email`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=604 ;

Does anyone have idea why and how to fix it?

This same query works perfectly on my local machine, and worked as well on my previous host. It's from a mature project - phpdevshell.

I'm using phpMyAdmin.

Community
  • 1
  • 1
  • Please provide the complete error details – Pallavi Feb 29 '16 at 09:06
  • Possible duplicate of [Mysql::Error: Specified key was too long; max key length is 1000 bytes](http://stackoverflow.com/questions/3489041/mysqlerror-specified-key-was-too-long-max-key-length-is-1000-bytes) – Giorgos Betsos Feb 29 '16 at 09:08
  • 1
    The size of some of those fields might be much larger than any value they would ever hold - I know of no-one with 5000 characters for their first name, and a 5000 character mobile number also seems too much. – Andrew Morton Feb 29 '16 at 09:09
  • I'd either change the email address field down to a reasonable size - i.e. maybe (absolute max) of 100 chars, and / or change it's field to not be UTF8 (double byte char set). – FreudianSlip Feb 29 '16 at 09:14
  • [What is the maximum length of a valid email address?](http://stackoverflow.com/a/574698/1115360) - 254 characters. – Andrew Morton Feb 29 '16 at 09:34

0 Answers0