WordPress.org

Support

Support » Plugins and Hacks » Weekly Class Schedule » [Resolved] Mysql errors

[Resolved] Mysql errors

  • When i try to install this plugin, it gives following errors:

    WordPress database error: [Specified key was too long; max key length is 767 bytes]
    CREATE TABLE wp_wcs2_class ( id int(11) NOT NULL AUTO_INCREMENT, class_name varchar(256) DEFAULT '' NOT NULL, class_description text, time_created varchar(50) NOT NULL DEFAULT '', user_created bigint(20) NOT NULL, time_modified varchar(50) NOT NULL DEFAULT '', user_modified bigint(20) NOT NULL, PRIMARY KEY (id), UNIQUE KEY class_name (class_name) )
    
    WordPress database error: [Specified key was too long; max key length is 767 bytes]
    CREATE TABLE wp_wcs2_classroom ( id int(11) NOT NULL AUTO_INCREMENT, classroom_name varchar(256) NOT NULL DEFAULT '', classroom_description text, time_created varchar(50) NOT NULL DEFAULT '', user_created bigint(20) NOT NULL, time_modified varchar(50) NOT NULL DEFAULT '', user_modified bigint(20) NOT NULL, PRIMARY KEY (id), UNIQUE KEY classroom_name (classroom_name) )
    
    WordPress database error: [Specified key was too long; max key length is 767 bytes]
    CREATE TABLE wp_wcs2_instructor ( id int(11) NOT NULL AUTO_INCREMENT, instructor_name varchar(256) NOT NULL DEFAULT '', instructor_description text, time_created varchar(50) NOT NULL DEFAULT '', user_created bigint(20) NOT NULL, time_modified varchar(50) NOT NULL DEFAULT '', user_modified bigint(20) NOT NULL, PRIMARY KEY (id), UNIQUE KEY instructor_name (instructor_name) )

    I don’t quite get the problem.

    http://wordpress.org/plugins/weekly-class-schedule/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Oh, i see. I guess it’s because of UTF8 encoding on my database and unique indexing those varchar fields.

    So this plugin has problem with UTF8 encoded mysql database.

    Problem can be solved by using shorter unique keys like this
    `UNIQUE KEY instructor_name (instructor_name(40))

    How many times you’ve instructors that have first 10 letters the same? Not very often, i hope 🙂

    Hi,
    I got exactly the same error.

    I had followed your advice and modified the file includes/WcsDb.php (all three occurrences).

    However, when I try to add a new classroom or a new instructor, I still get the error “Failed to add item to the database“. What am I doing wrong?

    Thanks in advance.

    Plugin fails to clear itself up when deleting it. I guess this is your case. Open your DB with phpmyadmin or similar and delete all the tables related to this plugin.

    Then try again. Hopefully your life just gets better then.

    Hi jazmo_,

    thanks a lot, this worked! My life is much, much better now.

    Manual for other desperate users:
    1) Go to wp-content/plugins/weekly-class-schedule/includes/WcsDb.php and change:

    UNIQUE KEY class_name (class_name) --> UNIQUE KEY class_name (class_name(40))
    UNIQUE KEY classroom_name (classroom_name) --> UNIQUE KEY classroom_name (classroom_name(40))
    UNIQUE KEY instructor_name (instructor_name) --> UNIQUE KEY instructor_name (instructor_name)

    2) Change all occurrences of varchar(256) to varchar(255)

    3) De-activate the plugin

    4) Go to phpMyAdmin and drop (delete) all databases that have wcs* of ws* and either class, classroom, schedule or instructor in their name.

    5) Re-activate the plugin.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Mysql errors’ is closed to new replies.
Skip to toolbar