SQL error in migration: Mysqli statement execute error : Table 'omeka_keys' already exists

I am upgrading Omeka from 2.4 to 2.5 and after copying all the relevant files over to the new unzip i immediately get this error when running the database upgrade:

exception ‘Zend_Db_Statement_Mysqli_Exception’ with message ‘Mysqli statement execute error : Table ‘omeka_keys’ already exists’ in /www/misc_sites/exhibits/application/libraries/Zend/Db/Statement/Mysqli.php:214
Stack trace:
#0 /www/misc_sites/exhibits/application/libraries/Zend/Db/Statement.php(303): Zend_Db_Statement_Mysqli->_execute(Array)
#1 /www/misc_sites/exhibits/application/libraries/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#2 [internal function]: Zend_Db_Adapter_Abstract->query(‘CREATE TABLE o...') #3 /www/misc_sites/exhibits/application/libraries/Omeka/Db.php(79): call_user_func_array(Array, Array) #4 /www/misc_sites/exhibits/application/libraries/Omeka/Db.php(282): Omeka_Db->__call('query', Array) #5 /www/misc_sites/exhibits/application/libraries/Omeka/Db.php(282): Omeka_Db->query('CREATE TABLEo…’)
#6 /www/misc_sites/exhibits/application/migrations/20130426000000_addApiKey.php(27): Omeka_Db->queryBlock(‘CREATE TABLE `o…’)
#7 /www/misc_sites/exhibits/application/libraries/Omeka/Db/Migration/Manager.php(231): addApiKey->up()
#8 /www/misc_sites/exhibits/application/libraries/Omeka/Db/Migration/Manager.php(111): Omeka_Db_Migration_Manager->_migrateUp(Object(DateTime))
#9 /www/misc_sites/exhibits/application/controllers/UpgradeController.php(49): Omeka_Db_Migration_Manager->migrate()
#10 /www/misc_sites/exhibits/application/libraries/Zend/Controller/Action.php(516): UpgradeController->migrateAction()
#11 /www/misc_sites/exhibits/application/libraries/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch(‘migrateAction’)
#12 /www/misc_sites/exhibits/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#13 /www/misc_sites/exhibits/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(105): Zend_Controller_Front->dispatch()
#14 /www/misc_sites/exhibits/application/libraries/Zend/Application.php(384): Zend_Application_Bootstrap_Bootstrap->run()
#15 /www/misc_sites/exhibits/application/libraries/Omeka/Application.php(77): Zend_Application->run()
#16 /www/misc_sites/exhibits/admin/index.php(28): Omeka_Application->run()
#17 {main}

Any ideas? Thanks

Are you sure you’re upgrading from Omeka 2.4? The migration that’s being run there is much much older than 2.4.

Omeka keeps a “schema_migrations” table that keeps track of every migration that’s been run, essentially keeping track of what version the database is. If you really have/had a 2.4 install, this would indicate there’s some problem with your schema_migrations table. The migration in your error message is “20130426000000”, and in a normal 2.4 install, there would be a row in the schema_migrations table with that value.