Tuesday, October 19, 2010

Re-creating user 0 fixes inaccessible Drupal site

Devbee explains why user 0, the default user is so important in Drupal. A missing user 0 can mean that your site cannot be reached from the outside!

If you find yourself having trouble accessing cotent or using your site as an anonymous user, you can safely run the following queries against your Drupal DB (4.6/4.7):

INSERT INTO users (uid, name, mail) VALUES ('0', '', '');
INSERT INTO users_roles (uid, rid) VALUES (0, 1);
INSERT INTO node_access VALUES (0, 0, 'all', 1, 0, 0);

If any of the queries above returns a "duplicate entry" error, that means a row already exists, and that table is already OK.

No comments: