For some reason, my site died on me (http://drupal.org/node/44818).

Fortunately, I had db backups for every six hours. Would I be doing the right thing by deleting the db tables of the dead site and running the backup sql file? Is there anything else I need to be careful about?

Comments

Zen’s picture

That should do it except for the auto_increment counters. So make sure that you don't just "empty"/TRUNCATE the tables, and actually DELETE them and recreate from your backup.

hth
-K

venkat-rk’s picture

Thanks!

Not wanting to take a chance, I created another test site and have got back almost everything from the production site (event module seems to have got turned off on its own) except that not even one user (including uid1) is able to login. To rule out a browser issue, I tested with IE, but with the same result.

I then tried getting a new password for both uid1 and uid2, but instead of returning the message that the password had been emailed, I am being brought back to the login tab.

I am beginning to get desperate now.

Update: I did get the new password, but get the same behaviour (not able to login) even now.

fatfish’s picture

User ID 0 was missing !!!
I've Create a user with uid 0 (zero) and its all working now.
(fullish me the delete it in the first place ...)

..:| Tomer Fish |:..
fatFish - Lean Mean Coding Machine

venkat-rk’s picture

Wow! That's great news!

Where do I go and create this uid0- I know very very little SQL, but I can try. I have been moping around the last 20 hours looking for a solution.

sangamreddi’s picture

It would be easy to create with phpmyadmin or anything similar to it.

Just open the user's table and edit the uid 0 and add the filed values.

Sunny
www.gleez.com

venkat-rk’s picture

Thanks, Sunny.

I do have phpmyadmin and here's the uid 0 row:
INSERT INTO users VALUES("0","","","","0","0","0","","","0","0","0","","","","","");

You mean I have to put the values in the error message into the respective fields of uid 0?

sangamreddi’s picture

yes U need to put the values

VALUES (
'0', 'test, '5bf99ac1e54e5d2d286a3cc052fdb940', 'test@test.com', '0', '0', '0', '', '', '1135714874', '1136830954', '1', NULL , '', '', 'test@test.com', 'a:5:{s:5:"roles";a:1:{s:18:"authenticated user";i:2;}s:7:"contact";i:0;s:5:"pass1";s:0:"";s:5:"pass2";s:0:"";s:14:"tinymce_status";s:1:"0";}', '1136830946'
)

Soemthing like this. try with ur test site first and then do it on ur live site.

Sunny
www.gleez.com

venkat-rk’s picture

Thanks again.

I put these values (the ones shown in my error message) into the sessions table and it didn't work for the test site. I couldn't put the values in the users table because it doesn't have those fields.

sangamreddi’s picture

i haven't tried it, i'll give a try and let u know.

Sunny
www.gleez.com

venkat-rk’s picture

Well, after Sepeck's suggestion guided me to http://drupal.org/node/21120, I added uid 0 to the users table.

However, login still doesn't work and I get a page not found for almost every page. The thread says to add INSERT INTO users_roles (uid, rid) VALUES (0, 1); to the users_roles table to resolve this, but it is already there in the backed up sql file and I don't know what else to do.

Still stuck after 24 hours. Does anyone have any other suggestion?

What is mysterious to me is how it happened on its own. I didn't add any module since the last one month, did not add or delete a new user. It just went poof.

Zen’s picture

Can we have a look at the site? And do you have clean_urls enabled? If you do, turn it off - I'm assuming you can't log in to do so..

You can also turn off the cache etc. as outlined in the linked issue..

venkat-rk’s picture

Thanks for replying. Here is the original site and here is the site from the backed up database.

You are right- I am unable to login to turn off clean urls. Are you suggesting that I put the code in the linked issue into my settings.php to solve this problem?

----
Acknowledging a reply to your question motivates the replier to answer more.

kbahey’s picture

Just to update everyone on what the cause was. ramdak asked me to look into it, so I did:

The duplicate error on sessions was indeed caused by the fact that there was no row for user 0 (anonymous) in the users table.

The solution is to do this in MySQL or PHPMyAdmin:

INSERT INTO users (uid) VALUES (0);

Then the duplicate error went away.

There were other issues as well, like user 1 not being present, and the node table was empty, ...etc. Don't know what caused all this, but the duplicate error was caused by the lack of user 0.
--
Drupal development and customization: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

Zen’s picture

I was just replying to this - did you get a chance to look at the original site with the access denied and page not found errors?

Cheers
-K

venkat-rk’s picture

Thanks everyone for the help.

Khalid is being very modest. I actually turned to him in desperation. As he mentioned, my specific case was way more complicated. However, with his help, I was able to recover my login and access to the admin pages and that's what mattered really.

I still have to recreate 60+ nodes, 300+ taxo terms, about 120+ user accounts etc., but without Khalid's timely help, I would be completely lost.

Thanks, Drupal community!

P.S: I still don't know what caused the error in the first place. I went to great lengths not to fiddle around on a production site, so I had installed another test site to check each module, each customisation before replicating it on the production site.

The only things I remember doing were:

1.) Changing the username of uid2
2.) Turning on the Who's online block
3.) Cron runs on dba module to produce a backup every 6 hours. Could this have corrupted the db somehow? The first warning sign was when I got a 'Cron run not completed' message.

My host upgraded to MySQL 4.1.14 about two weeks back and I noticed that the collation had changed. Could this be the reason?