Title: Mysql errors
Last modified: August 21, 2016

---

# Mysql errors

 *  Resolved [jazmo_](https://wordpress.org/support/users/jazmo_/)
 * (@jazmo_)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/mysql-errors-5/)
 * 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/](http://wordpress.org/plugins/weekly-class-schedule/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [jazmo_](https://wordpress.org/support/users/jazmo_/)
 * (@jazmo_)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/mysql-errors-5/#post-4019738)
 * 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.
 *  Thread Starter [jazmo_](https://wordpress.org/support/users/jazmo_/)
 * (@jazmo_)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/mysql-errors-5/#post-4019740)
 * 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 🙂
 *  [Augustin_Zidek](https://wordpress.org/support/users/augustin_zidek/)
 * (@augustin_zidek)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/mysql-errors-5/#post-4019918)
 * 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.
 *  Thread Starter [jazmo_](https://wordpress.org/support/users/jazmo_/)
 * (@jazmo_)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/mysql-errors-5/#post-4019919)
 * 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.
 *  [Augustin_Zidek](https://wordpress.org/support/users/augustin_zidek/)
 * (@augustin_zidek)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/mysql-errors-5/#post-4019920)
 * 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 ‘Mysql errors’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/weekly-class-schedule_e7e1ae.svg)
 * [Weekly Class Schedule](https://wordpress.org/plugins/weekly-class-schedule/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/weekly-class-schedule/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/weekly-class-schedule/)
 * [Active Topics](https://wordpress.org/support/plugin/weekly-class-schedule/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/weekly-class-schedule/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/weekly-class-schedule/reviews/)

## Tags

 * [MySQL](https://wordpress.org/support/topic-tag/mysql/)

 * 5 replies
 * 2 participants
 * Last reply from: [Augustin_Zidek](https://wordpress.org/support/users/augustin_zidek/)
 * Last activity: [12 years, 9 months ago](https://wordpress.org/support/topic/mysql-errors-5/#post-4019920)
 * Status: resolved