I'm trying to update from 5.x to 6.x (5.14 to 6.8), and after running update.php I get the customary
Updates were attempted. If you see no failures below, you may proceed happily to the administration pages. Otherwise, you may need to update your database manually. All errors have been logged.
But since I see several failures below, I need to (less happily) update my database manually. How do I do that?
I'd like help with two things with this forum post:
- We should have a handbook page on what to do in this situation, with whatever general advice can be given. I'll write it, but right now I don't know what it should say
- And, naturally, I'd like help with my specific problem
General handbook page
Start with a few pointers on how to get at your database (for instance Cpanel or command line + http://dev.mysql.com/doc/index.html).
My first questions:
There were a lot more error messages on the landing page I got to after update.php, than in the log. I assume both sets are relevant, and that the user should copy them all to a text file before doing anything else. Correct? Or can the user assume that all she needs to know is in the log?
When error messages on the landing page give "Failed: CREATE TABLE {something}, the user can look for the table. If it exists, can she assume that this isn't a problem, and ignore that error message?
If it doesn't exist, what should she do?
What about messages like "Failed: INSERT INTO {table name} (lots of stuff...}"
What should the user do about those?
My specific problem
After replacing the files and going to update.php (but before running it) I get the following warning (in a red box at the top of the page):
user warning: Table 'cache_block' already exists query: CREATE TABLE cache_block ( `cid` VARCHAR(255) NOT NULL DEFAULT '', `data` LONGBLOB DEFAULT NULL, `expire` INT NOT NULL DEFAULT 0, `created` INT NOT NULL DEFAULT 0, `headers` TEXT DEFAULT NULL, `serialized` SMALLINT NOT NULL DEFAULT 0, PRIMARY KEY (cid), INDEX expire (expire) ) /*!40100 DEFAULT CHARACTER SET UTF8 */ in /home/pvv/c/pvv/web-root/hexagon/hexcon_test/includes/database.inc on line 515.
After running update.php, I got these in the same red box:
* user warning: Table 'cache_form' already exists query: CREATE TABLE cache_form ( cid varchar(255) NOT NULL default '', data longblob, expire int NOT NULL default '0', created int NOT NULL default '0', headers text, serialized int(1) NOT NULL default '0', PRIMARY KEY (cid), INDEX expire (expire) ) /*!40100 DEFAULT CHARACTER SET UTF8 */ in /home/pvv/c/pvv/web-root/hexagon/hexcon_test/modules/system/system.install on line 1399.
* user warning: Table 'menu_router' already exists query: CREATE TABLE menu_router ( `path` VARCHAR(255) NOT NULL DEFAULT '', `load_functions` VARCHAR(255) NOT NULL DEFAULT '', `to_arg_functions` VARCHAR(255) NOT NULL DEFAULT '', `access_callback` VARCHAR(255) NOT NULL DEFAULT '', `access_arguments` TEXT DEFAULT NULL, `page_callback` VARCHAR(255) NOT NULL DEFAULT '', `page_arguments` TEXT DEFAULT NULL, `fit` INT NOT NULL DEFAULT 0, `number_parts` SMALLINT NOT NULL DEFAULT 0, `tab_parent` VARCHAR(255) NOT NULL DEFAULT '', `tab_root` VARCHAR(255) NOT NULL DEFAULT '', `title` VARCHAR(255) NOT NULL DEFAULT '', `title_callback` VARCHAR(255) NOT NULL DEFAULT '', `title_arguments` VARCHAR(255) NOT NULL DEFAULT '', `type` INT NOT NULL DEFAULT 0, `block_callback` VARCHAR(255) NOT NULL DEFAULT '', `description` TEXT NOT NULL, `position` VARCHAR(255) NOT NULL DEFAULT '', `weight` INT NOT NULL DEFAULT 0, `file` MEDIUMTEXT DEFAULT NULL, PRIMARY KEY (path), INDEX fit (fit), INDEX tab_parent (tab_parent) ) /*!40100 DEFAULT CHARACTER SET UTF8 */ in /home/pvv/c/pvv/web-root/hexagon/hexcon_test/includes/database.inc on line 515.
* user warning: Table 'menu_links' already exists query: CREATE TABLE menu_links ( `menu_name` VARCHAR(32) NOT NULL DEFAULT '', `mlid` INT unsigned NOT NULL auto_increment, `plid` INT unsigned NOT NULL DEFAULT 0, `link_path` VARCHAR(255) NOT NULL DEFAULT '', `router_path` VARCHAR(255) NOT NULL DEFAULT '', `link_title` VARCHAR(255) NOT NULL DEFAULT '', `options` TEXT DEFAULT NULL, `module` VARCHAR(255) NOT NULL DEFAULT 'system', `hidden` SMALLINT NOT NULL DEFAULT 0, `external` SMALLINT NOT NULL DEFAULT 0, `has_children` SMALLINT NOT NULL DEFAULT 0, `expanded` SMALLINT NOT NULL DEFAULT 0, `weight` INT NOT NULL DEFAULT 0, `depth` SMALLINT NOT NULL DEFAULT 0, `customized` SMALLINT NOT NULL DEFAULT 0, `p1` INT unsigned NOT NULL DEFAULT 0, `p2` INT unsigned NOT NULL DEFAULT 0, `p3` INT unsigned NOT NULL DEFAULT 0, `p4` INT unsigned NOT NULL DEFAULT 0, `p5` INT unsigned NOT NULL DEFAULT 0, `p6` INT unsigned NOT NULL DEFAULT 0, `p7` INT unsigned NOT NULL DEFAULT 0, `p8` INT unsigned NOT NULL DEFAULT 0, `p9` INT unsigned NOT NULL DEFAULT 0, `updated` SMALLINT NOT NULL DEFAULT 0, PRIMARY KEY (mlid), INDEX path_menu (link_path(128), menu_name), INDEX menu_plid_expand_child (menu_name, plid, expanded, has_children), INDEX menu_parents (menu_name, p1, p2, p3, p4, p5, p6, p7, p8, p9), INDEX router_path (router_path(128)) ) /*!40100 DEFAULT CHARACTER SET UTF8 */ in /home/pvv/c/pvv/web-root/hexagon/hexcon_test/includes/database.inc on line 515.
* user warning: Table 'menu_custom' already exists query: CREATE TABLE menu_custom ( `menu_name` VARCHAR(32) NOT NULL DEFAULT '', `title` VARCHAR(255) NOT NULL DEFAULT '', `description` TEXT DEFAULT NULL, PRIMARY KEY (menu_name) ) /*!40100 DEFAULT CHARACTER SET UTF8 */ in /home/pvv/c/pvv/web-root/hexagon/hexcon_test/includes/database.inc on line 515.
* user warning: Duplicate entry 'navigation' for key 1 query: INSERT INTO menu_custom (menu_name, title, description) VALUES ('navigation', 'Navigation', 'The navigation menu is provided by Drupal and is the main interactive menu for any site. It is usually the only menu that contains personalized links for authenticated users, and is often not even visible to anonymous users.') in /home/pvv/c/pvv/web-root/hexagon/hexcon_test/modules/system/system.install on line 1735.
* user warning: Duplicate entry 'primary-links' for key 1 query: UPDATE menu_custom SET menu_name = 'primary-links', description = 'Primary links are often used at the theme layer to show the major sections of a site. A typical representation for primary links would be tabs along the top.' WHERE menu_name = 'menu-prim--re-lenker0' in /home/pvv/c/pvv/web-root/hexagon/hexcon_test/modules/system/system.install on line 1848.
* user warning: Duplicate entry 'secondary-links' for key 1 query: INSERT INTO menu_custom (menu_name, title, description) VALUES ('secondary-links', 'Secondary links', 'Secondary links are often used for pages like legal notices, contact details, and other secondary navigation items that play a lesser role than primary links.') in /home/pvv/c/pvv/web-root/hexagon/hexcon_test/modules/system/system.install on line 1866.
* user warning: Table 'upload' already exists query: ALTER TABLE file_revisions RENAME TO upload in /home/pvv/c/pvv/web-root/hexagon/hexcon_test/includes/database.mysql-common.inc on line 249.
* user warning: Duplicate column name 'nid' query: ALTER TABLE upload ADD `nid` INT unsigned NOT NULL DEFAULT 0 in /home/pvv/c/pvv/web-root/hexagon/hexcon_test/includes/database.mysql-common.inc on line 298.
* user warning: Duplicate key name 'nid' query: ALTER TABLE upload ADD INDEX nid (nid) in /home/pvv/c/pvv/web-root/hexagon/hexcon_test/includes/database.mysql-common.inc on line 434.
* user warning: Multiple primary key defined query: ALTER TABLE upload ADD PRIMARY KEY (vid, fid) in /home/pvv/c/pvv/web-root/hexagon/hexcon_test/includes/database.mysql-common.inc on line 374.
* user warning: Duplicate key name 'fid' query: ALTER TABLE upload ADD INDEX fid (fid) in /home/pvv/c/pvv/web-root/hexagon/hexcon_test/includes/database.mysql-common.inc on line 434.
* user warning: Table 'actions_old_contrib' already exists query: ALTER TABLE actions RENAME TO actions_old_contrib in /home/pvv/c/pvv/web-root/hexagon/hexcon_test/includes/database.mysql-common.inc on line 249.
* user warning: Table 'actions' already exists query: CREATE TABLE actions ( `aid` VARCHAR(255) NOT NULL DEFAULT '0', `type` VARCHAR(32) NOT NULL DEFAULT '', `callback` VARCHAR(255) NOT NULL DEFAULT '', `parameters` LONGTEXT NOT NULL, `description` VARCHAR(255) NOT NULL DEFAULT '0', PRIMARY KEY (aid) ) /*!40100 DEFAULT CHARACTER SET UTF8 */ in /home/pvv/c/pvv/web-root/hexagon/hexcon_test/includes/database.inc on line 515.
* user warning: Table 'actions_aid' already exists query: CREATE TABLE actions_aid ( `aid` INT unsigned NOT NULL auto_increment, PRIMARY KEY (aid) ) /*!40100 DEFAULT CHARACTER SET UTF8 */ in /home/pvv/c/pvv/web-root/hexagon/hexcon_test/includes/database.inc on line 515.
* user warning: Duplicate column name 'weight' query: ALTER TABLE upload ADD `weight` TINYINT NOT NULL DEFAULT 0 in /home/pvv/c/pvv/web-root/hexagon/hexcon_test/includes/database.mysql-common.inc on line 298.
* user warning: Table 'languages' already exists query: CREATE TABLE languages ( `language` VARCHAR(12) NOT NULL DEFAULT '', `name` VARCHAR(64) NOT NULL DEFAULT '', `native` VARCHAR(64) NOT NULL DEFAULT '', `direction` INT NOT NULL DEFAULT 0, `enabled` INT NOT NULL DEFAULT 0, `plurals` INT NOT NULL DEFAULT 0, `formula` VARCHAR(128) NOT NULL DEFAULT '', `domain` VARCHAR(128) NOT NULL DEFAULT '', `prefix` VARCHAR(128) NOT NULL DEFAULT '', `weight` INT NOT NULL DEFAULT 0, `javascript` VARCHAR(32) NOT NULL DEFAULT '', PRIMARY KEY (language), INDEX list (weight, name) ) /*!40100 DEFAULT CHARACTER SET UTF8 */ in /home/pvv/c/pvv/web-root/hexagon/hexcon_test/includes/database.inc on line 515.
* user warning: Duplicate entry 'en' for key 1 query: INSERT INTO languages (language, name, native, direction, enabled, plurals, formula, domain, prefix, weight) SELECT locale, name, name, 0, enabled, plurals, formula, '', locale, 0 FROM locales_meta in /home/pvv/c/pvv/web-root/hexagon/hexcon_test/modules/locale/locale.install on line 103.
And in the long list of updates run, the following were listed as failed:
Update #6015
* Failed: CREATE TABLE {cache_form} ( cid varchar(255) NOT NULL default '', data longblob, expire int NOT NULL default '0', created int NOT NULL default '0', headers text, serialized int(1) NOT NULL default '0', PRIMARY KEY (cid), INDEX expire (expire) ) /*!40100 DEFAULT CHARACTER SET UTF8 */
Update #6020
* Failed: CREATE TABLE {menu_router} ( `path` VARCHAR(255) NOT NULL DEFAULT '', `load_functions` VARCHAR(255) NOT NULL DEFAULT '', `to_arg_functions` VARCHAR(255) NOT NULL DEFAULT '', `access_callback` VARCHAR(255) NOT NULL DEFAULT '', `access_arguments` TEXT DEFAULT NULL, `page_callback` VARCHAR(255) NOT NULL DEFAULT '', `page_arguments` TEXT DEFAULT NULL, `fit` INT NOT NULL DEFAULT 0, `number_parts` SMALLINT NOT NULL DEFAULT 0, `tab_parent` VARCHAR(255) NOT NULL DEFAULT '', `tab_root` VARCHAR(255) NOT NULL DEFAULT '', `title` VARCHAR(255) NOT NULL DEFAULT '', `title_callback` VARCHAR(255) NOT NULL DEFAULT '', `title_arguments` VARCHAR(255) NOT NULL DEFAULT '', `type` INT NOT NULL DEFAULT 0, `block_callback` VARCHAR(255) NOT NULL DEFAULT '', `description` TEXT NOT NULL, `position` VARCHAR(255) NOT NULL DEFAULT '', `weight` INT NOT NULL DEFAULT 0, `file` MEDIUMTEXT DEFAULT NULL, PRIMARY KEY (path), INDEX fit (fit), INDEX tab_parent (tab_parent) ) /*!40100 DEFAULT CHARACTER SET UTF8 */
* Failed: CREATE TABLE {menu_links} ( `menu_name` VARCHAR(32) NOT NULL DEFAULT '', `mlid` INT unsigned NOT NULL auto_increment, `plid` INT unsigned NOT NULL DEFAULT 0, `link_path` VARCHAR(255) NOT NULL DEFAULT '', `router_path` VARCHAR(255) NOT NULL DEFAULT '', `link_title` VARCHAR(255) NOT NULL DEFAULT '', `options` TEXT DEFAULT NULL, `module` VARCHAR(255) NOT NULL DEFAULT 'system', `hidden` SMALLINT NOT NULL DEFAULT 0, `external` SMALLINT NOT NULL DEFAULT 0, `has_children` SMALLINT NOT NULL DEFAULT 0, `expanded` SMALLINT NOT NULL DEFAULT 0, `weight` INT NOT NULL DEFAULT 0, `depth` SMALLINT NOT NULL DEFAULT 0, `customized` SMALLINT NOT NULL DEFAULT 0, `p1` INT unsigned NOT NULL DEFAULT 0, `p2` INT unsigned NOT NULL DEFAULT 0, `p3` INT unsigned NOT NULL DEFAULT 0, `p4` INT unsigned NOT NULL DEFAULT 0, `p5` INT unsigned NOT NULL DEFAULT 0, `p6` INT unsigned NOT NULL DEFAULT 0, `p7` INT unsigned NOT NULL DEFAULT 0, `p8` INT unsigned NOT NULL DEFAULT 0, `p9` INT unsigned NOT NULL DEFAULT 0, `updated` SMALLINT NOT NULL DEFAULT 0, PRIMARY KEY (mlid), INDEX path_menu (link_path(128), menu_name), INDEX menu_plid_expand_child (menu_name, plid, expanded, has_children), INDEX menu_parents (menu_name, p1, p2, p3, p4, p5, p6, p7, p8, p9), INDEX router_path (router_path(128)) ) /*!40100 DEFAULT CHARACTER SET UTF8 */Update #6021
* Failed: CREATE TABLE {menu_custom} ( `menu_name` VARCHAR(32) NOT NULL DEFAULT '', `title` VARCHAR(255) NOT NULL DEFAULT '', `description` TEXT DEFAULT NULL, PRIMARY KEY (menu_name) ) /*!40100 DEFAULT CHARACTER SET UTF8 */
* Failed: UPDATE {menu_custom} SET menu_name = 'primary-links', description = 'Primary links are often used at the theme layer to show the major sections of a site. A typical representation for primary links would be tabs along the top.' WHERE menu_name = 'menu-prim--re-lenker0'Update #6022
# Failed: ALTER TABLE {file_revisions} RENAME TO {upload}
# Failed: ALTER TABLE {upload} ADD `nid` INT unsigned NOT NULL DEFAULT 0
# Failed: ALTER TABLE {upload} ADD INDEX nid (nid)
# Failed: ALTER TABLE {upload} ADD PRIMARY KEY (vid, fid)
# Failed: ALTER TABLE {upload} ADD INDEX fid (fid)Update #6030
* Failed: ALTER TABLE {actions} RENAME TO {actions_old_contrib}
* Failed: CREATE TABLE {actions} ( `aid` VARCHAR(255) NOT NULL DEFAULT '0', `type` VARCHAR(32) NOT NULL DEFAULT '', `callback` VARCHAR(255) NOT NULL DEFAULT '', `parameters` LONGTEXT NOT NULL, `description` VARCHAR(255) NOT NULL DEFAULT '0', PRIMARY KEY (aid) ) /*!40100 DEFAULT CHARACTER SET UTF8 */
* Failed: CREATE TABLE {actions_aid} ( `aid` INT unsigned NOT NULL auto_increment, PRIMARY KEY (aid) ) /*!40100 DEFAULT CHARACTER SET UTF8 */Update #6040
* Failed: ALTER TABLE {upload} ADD `weight` TINYINT NOT NULL DEFAULT 0
Update #6000
* Failed: CREATE TABLE {languages} ( `language` VARCHAR(12) NOT NULL DEFAULT '', `name` VARCHAR(64) NOT NULL DEFAULT '', `native` VARCHAR(64) NOT NULL DEFAULT '', `direction` INT NOT NULL DEFAULT 0, `enabled` INT NOT NULL DEFAULT 0, `plurals` INT NOT NULL DEFAULT 0, `formula` VARCHAR(128) NOT NULL DEFAULT '', `domain` VARCHAR(128) NOT NULL DEFAULT '', `prefix` VARCHAR(128) NOT NULL DEFAULT '', `weight` INT NOT NULL DEFAULT 0, `javascript` VARCHAR(32) NOT NULL DEFAULT '', PRIMARY KEY (language), INDEX list (weight, name) ) /*!40100 DEFAULT CHARACTER SET UTF8 */
* Failed: INSERT INTO {languages} (language, name, native, direction, enabled, plurals, formula, domain, prefix, weight) SELECT locale, name, name, 0, enabled, plurals, formula, '', locale, 0 FROM {locales_meta}
In the log I find the following error messages:
Duplicate entry 'en' for key 1 query: INSERT INTO languages (language, name, native, direction, enabled, plurals, formula, domain, prefix, weight) SELECT locale, name, name, 0, enabled, plurals, formula, '', locale, 0 FROM locales_meta i /home/pvv/c/pvv/web-root/hexagon/hexcon_test/modules/locale/locale.install på linje 103.
Table 'languages' already exists query: CREATE TABLE languages ( `language` VARCHAR(12) NOT NULL DEFAULT '', `name` VARCHAR(64) NOT NULL DEFAULT '', `native` VARCHAR(64) NOT NULL DEFAULT '', `direction` INT NOT NULL DEFAULT 0, `enabled` INT NOT NULL DEFAULT 0, `plurals` INT NOT NULL DEFAULT 0, `formula` VARCHAR(128) NOT NULL DEFAULT '', `domain` VARCHAR(128) NOT NULL DEFAULT '', `prefix` VARCHAR(128) NOT NULL DEFAULT '', `weight` INT NOT NULL DEFAULT 0, `javascript` VARCHAR(32) NOT NULL DEFAULT '', PRIMARY KEY (language), INDEX list (weight, name) ) /*!40100 DEFAULT CHARACTER SET UTF8 */ i /home/pvv/c/pvv/web-root/hexagon/hexcon_test/includes/database.inc på linje 515.
Duplicate column name 'weight' query: ALTER TABLE upload ADD `weight` TINYINT NOT NULL DEFAULT 0 i /home/pvv/c/pvv/web-root/hexagon/hexcon_test/includes/database.mysql-common.inc på linje 298.
Table 'actions_aid' already exists query: CREATE TABLE actions_aid ( `aid` INT unsigned NOT NULL auto_increment, PRIMARY KEY (aid) ) /*!40100 DEFAULT CHARACTER SET UTF8 */ i /home/pvv/c/pvv/web-root/hexagon/hexcon_test/includes/database.inc på linje 515.
Table 'actions' already exists query: CREATE TABLE actions ( `aid` VARCHAR(255) NOT NULL DEFAULT '0', `type` VARCHAR(32) NOT NULL DEFAULT '', `callback` VARCHAR(255) NOT NULL DEFAULT '', `parameters` LONGTEXT NOT NULL, `description` VARCHAR(255) NOT NULL DEFAULT '0', PRIMARY KEY (aid) ) /*!40100 DEFAULT CHARACTER SET UTF8 */ i /home/pvv/c/pvv/web-root/hexagon/hexcon_test/includes/database.inc på linje 515.
Table 'actions_old_contrib' already exists query: ALTER TABLE actions RENAME TO actions_old_contrib i /home/pvv/c/pvv/web-root/hexagon/hexcon_test/includes/database.mysql-common.inc på linje 249.
The site has three sets of most menu links, but seems otherwise to work OK. admin/reports/status is all green.
My database skills conists of having found http://dev.mysql.com/doc/index.html and knowing how to read, but I've checked some of the things that were listed as "failed" and the tables seem to be there, the renamings seem to have taken place. I haven't found out how to check a "Failed: INSERT INTO" message, yet.
Any suggestions for what I do now? I have MySQL 5.0.32, and PHP 5.2.0-8+etch13.
Comments
It looks to me like the upgrade had already been run
Most of those errors look like they are caused by the upgrade having already been run, the cache_block table for example wouldn't have existed in your Drupal 5 installation - and the fact that you have 3 sets of menu links implies that the upgrade has been run 3 times?
Mike,
Computerminds offer Drupal development, consulting and training
Mike,
Computerminds offer Drupal development, consulting and training
Thanks!
Thanks, that solved it!
I thought I was running each update attempt on a new, clean copy of my live site. The command I used to copy the database from my live site to my test site was:
Now I've looked closer at the command, and found that it doesn't wipe test_database_name, it just overwrites tables with content from my 2009-01-10 backup. So any tables that were present there from earlier upgrade attempts were still there.
Now I've run DROP TABLES, removing all tables from test_database_name, and then copied the content from my backup. And then I ran an upgrade, and everything went fine. Thanks a lot! :-)
That leaves me with the task of writing a handbook page with general advice for people who get this error message, as I promised. I've moved that over to the docs issue queue: #357327: No information on how to update your database manually when update.php fails Any suggestions on what should be on that page will be very welcome.