WordPress.org

Ready to get started?Download WordPress

Forums

Weekly Class Schedule
[resolved] Mysql errors (6 posts)

  1. jazmo_
    Member
    Posted 11 months ago #

    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/

  2. jazmo_
    Member
    Posted 11 months ago #

    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.

  3. jazmo_
    Member
    Posted 11 months ago #

    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 :)

  4. Augustin_Zidek
    Member
    Posted 10 months ago #

    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.

  5. jazmo_
    Member
    Posted 10 months ago #

    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.

  6. Augustin_Zidek
    Member
    Posted 10 months ago #

    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.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags