• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Server issue  Mysqli statement execute error: Specified key was too long; max key len is 767 bytes

Romchik®

Well-known member
#1
Possible XF bug or Server Problem?

MySQL: 6.0
XF Test - passed
Server Error

Mysqli statement execute error : Specified key was too long; max key length is 767 bytes
Zend_Db_Statement_Mysqli->_execute() in ***/library/Zend/Db/Statement.php at line 317
Zend_Db_Statement->execute() in ***/library/Zend/Db/Adapter/Abstract.php at line 479
Zend_Db_Adapter_Abstract->query() in ***/library/XenForo/Install/Model/Install.php at line 174
XenForo_Install_Model_Install->createApplicationTables() in ***/library/XenForo/Install/Controller/Install.php at line 196
XenForo_Install_Controller_Install->actionStep2() in ***/library/XenForo/FrontController.php at line 310
XenForo_FrontController->dispatch() in ***/library/XenForo/FrontController.php at line 132
XenForo_FrontController->run() in ***/install/index.php at line 17
 

Mike

XenForo developer
Staff member
#2
Do you know what the last created table was? (As it will be the next one that caused the error.)
 
R

ragtek

Guest
#4
Isn't this because of
PHP:
$tables['xf_feed'] = "
    CREATE TABLE xf_feed (
        feed_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
        title VARCHAR(250) NOT NULL,
        url VARCHAR(2083) NOT NULL,
        frequency INT UNSIGNED NOT NULL DEFAULT 1800,
        node_id INT UNSIGNED NOT NULL,
        user_id INT UNSIGNED NOT NULL DEFAULT 0,
        title_template VARCHAR(250) NOT NULL DEFAULT '',
        message_template MEDIUMTEXT NOT NULL,
        discussion_visible TINYINT UNSIGNED NOT NULL DEFAULT 1,
        discussion_open TINYINT UNSIGNED NOT NULL DEFAULT 1,
        discussion_sticky TINYINT UNSIGNED NOT NULL DEFAULT 0,
        last_fetch INT UNSIGNED NOT NULL DEFAULT 0,
        active INT UNSIGNED NOT NULL DEFAULT 0,
        PRIMARY KEY (feed_id),
        KEY active (active)
    ) ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci
";
url VARCHAR(2083) NOT NULL,

http://dev.mysql.com/doc/refman/5.0/en/char.html
Values in VARCHAR columns are variable-length strings. The length can be specified as a value from 0 to 255 before MySQL 5.0.3, and 0 to 65,535 in 5.0.3 and later versions
And xf requires
  • MySQL: 5.0+

This doesn't work for mysql <= 5.0.3, right?
 

Mike

XenForo developer
Staff member
#5
This is a bug really - it's the xf_feed_log table. I'm unsure why we haven't run into it before. What version of MySQL? (6.0 can't be accurate...) it looks like ideally we need to shorten the columns a bit. (I could change them to binary potentially, though there is the risk of UTF-8 characters being truncated too earlier.)

I think as a workaround you could make the table MyISAM instead of InnoDB, but I will likely shorten the column a bit for 1.1.