Sometimes the only way to regain access to your drupal site is to remove information from the cache tables manually.
This script should save you some time.
delete FROM drupal7.cache; delete FROM drupal7.cache_admin_menu; delete FROM drupal7.cache_block; delete FROM drupal7.cache_bootstrap; delete FROM drupal7.cache_field; delete FROM drupal7.cache_filter; delete FROM drupal7.cache_form; delete FROM drupal7.cache_image; delete FROM drupal7.cache_libraries; delete FROM drupal7.cache_media_xml; delete FROM drupal7.cache_menu; delete FROM drupal7.cache_page; delete FROM drupal7.cache_path; delete FROM drupal7.cache_token; delete FROM drupal7.cache_update; delete FROM drupal7.cache_views; delete FROM drupal7.cache_views_data; delete FROM drupal7.cache_widgets;