Last night, I attempted to add a web-based volunteer management program (non-Drupal) on my main domain, but I accidentally uploaded all the mysql tables to the same mysql database as the one I'm using for Drupal.
Then, when I logged into Drupal, I got the following errors:
Warning: Table 'joy0722804033891.users' doesn't exist query: SELECT u.*, s.* FROM users u INNER JOIN sessions s ON u.uid = s.uid WHERE s.sid = '233297e29b47acbea2adbcca757625ad' in /home/content/j/o/y/joymelissajoy/html/txdirectory/includes/database.mysql.inc on line 172

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/content/j/o/y/joymelissajoy/html/txdirectory/includes/database.mysql.inc:172) in /home/content/j/o/y/joymelissajoy/html/txdirectory/includes/bootstrap.inc on line 811

Warning: Cannot modify header information - headers already sent by (output started at /home/content/j/o/y/joymelissajoy/html/txdirectory/includes/database.mysql.inc:172) in /home/content/j/o/y/joymelissajoy/html/txdirectory/includes/bootstrap.inc on line 488

Warning: Cannot modify header information - headers already sent by (output started at /home/content/j/o/y/joymelissajoy/html/txdirectory/includes/database.mysql.inc:172) in /home/content/j/o/y/joymelissajoy/html/txdirectory/includes/bootstrap.inc on line 489

Warning: Cannot modify header information - headers already sent by (output started at /home/content/j/o/y/joymelissajoy/html/txdirectory/includes/database.mysql.inc:172) in /home/content/j/o/y/joymelissajoy/html/txdirectory/includes/bootstrap.inc on line 490

Warning: Cannot modify header information - headers already sent by (output started at /home/content/j/o/y/joymelissajoy/html/txdirectory/includes/database.mysql.inc:172) in /home/content/j/o/y/joymelissajoy/html/txdirectory/includes/bootstrap.inc on line 491

I went back in and deleted the tables I had added through the other program, but it didn't fix the errors, and now I'm wondering if I also deleted tables that Drupal was using, with the same name.
Any thoughts on how to fix this?

Comments

pbarnett’s picture

Hi!

If so, you can simply restore it; otherwise, you're likely to have to recreate the site from scratch.

It's a good idea to ALWAYS back up your database before changing anything...

Pete.

joy_m_n’s picture

Ack!!
Do I have to re-do the WHOLE site? Or just the databases?
(because, of course, I didn't back it up.......*kicks self*)
Can I just drop a new table in phpmyadmin?

pbarnett’s picture

Hi!

You should be able to drop and recreate the database, then let drupal repopulate it.

You'll not need to reinstall Drupal.

And you'll start doing backups, I guess :-)

Pete.

joy_m_n’s picture

Ok, so now my posts aren't showing up on the forums here! Weird.....

Take #3:
For clarification's sake: I should drop ALL the tables on the database? Or the info IN the tables on the database? What's your best description of how to accomplish that?

Also, how exactly does Drupal re-populate the database? Does it matter if I originally installed it via GoDAddy's Hosting Metropolis? I'm using their economy hosting, so some of the functions in phpmyadmin aren't available. For example, I'm having trouble figuring out how to add a new table in the database without importing an entire text file.

Any thoughts?
Thanks very much for the suggestions so far!

pbarnett’s picture

If you drop the entire database and recreate it (without tables) using phpmyadmin and then go to the site, drupal should detect this and take you through the installation process again.

I've noticed that new posts to the forum can take a while to appear; I've posted some duplicates myself due to a complete lack of anything resembling patience on my part :-)

Let me know if you have any problems with the installation; I can recreate the situation on a test site here if you need a walkthru...

Pete.

joy_m_n’s picture

OK, I'm on PHPmyadmin, but I can't find an option for dropping the database. I can figure out how to drop all TABLES, but then I get an error about how I 'can't delete header row', and something about a 'foreign key function'.

Help??

pbarnett’s picture

Hi.

I've got phpmyadmin 2.10.1; when I log in and select a database I can see a list of all the tables, with tabs along the top of the page for actions such as Search, Query, Export and so on. The last of these tabs is 'Drop'.

cog.rusty’s picture

First take a look with phpmyadmin to see yourself what the problem is.

Is there a 'users' table? A 'node' table? A 'system' table? Drupal used to have about 40 tables there. It is possible that the sql dump which you loaded has already dropped ALL existing tables (or else Drupal's 'users' table would still be there). Just see for yourself what happened.

If all Drupal tables are missing, then you will have to go to htttp://your-drupal-site/install.php to re-create them. It will be a new Drupal site. None of your old settings will be there.

joy_m_n’s picture

Ok, so I guess I somehow DID manage to drop all the Drupal databases.

My problem now is that I sign on to htttp://my-drupal-site/install.php and just get a bijillion error messages saying that those tables don't exist.
Checking in phpmyadmin, all the drupal tables are gone, but the civicrm tables (I have CiviCRM configured to work with Drupal) are still there.

Where do I go from here?

Thanks again!

joy_m_n’s picture

Is there a particular file that I can just import via phpmyadmin in order to add the tables back in?

cog.rusty’s picture

No, there is no such file in Drupal 5, the information is in /modules/system/system.install but that is not a file which you can import.

To make install.php work, upload a fresh /sites/default/settings.php file for the exact same Drupal version.

Or modify the one you have by setting

$db_url = 'mysql://username:password@localhost/databasename';
$db_prefix = '';

and

# $base_url = 'http://www.example.com';  // NO trailing slash!

to make it the way it was before installation. You will need to enter your database information again during the installation.

------Edited to add:

But are you sure that you don't have a second database and that you aren't just looking at the wrong one? I am wondering... why would that database import drop your Drupal tables?

joy_m_n’s picture

The Drupal tables were dropped when I tried out the 'dump' function.
The first few (a.k.a. users) were dropped after I deleted tables that were uploaded to work with a completely separate program.

So, I replaced the settings.php file, and went back to my www.mysite/install.php
This time, it just did the super-slow-page load thing. It still indicates that the page is loading, but the progress bar at the bottom of the page is at 100% and it still shows the content of the last page I was looking at prior to pointing my URL to the install.php page.

?????

pbarnett’s picture

I did a backup of my database, then dropped the entire database and created a new (empty) one with the same name using phpmyadmin.

When phpmyadmin had confirmed that the database had been created, I went to http://mysite.com and got, as you say, a bajillion error messages about missing tables.

I went to http://mysite.com/install.php and, after a short delay, got the 'Drupal installation complete' page.

I was then able to create the admin user and start to recreate the site.

Pete.

joy_m_n’s picture

When I went to the install.php page though, it STILL gave me the errors.
Now, I've uploaded a fresh settings.php file, and I'm getting a 404 Not Found error after the page tried to load itself for a long, long time. (and I hit refresh)

joy_m_n’s picture

I edited the settings.php file back to the configuration for my mysql host, and I went to the www.mysitedrupal/install.php page again.

I'm just going to include the first few error messages, for the sake of not completely clogging up the forums here, but there is more than a pageful altogether:

Warning: Table 'joy0722804033891.access' doesn't exist query: SELECT CASE WHEN status=1 THEN 0 ELSE 1 END FROM access WHERE type = 'host' AND LOWER('216.70.201.5') LIKE LOWER(mask) ORDER BY status DESC LIMIT 0, 1 in /home/content/j/o/y/joymelissajoy/html/txdirectory/includes/database.mysql.inc on line 172

Warning: Table 'joy0722804033891.users' doesn't exist query: SELECT u.*, s.* FROM users u INNER JOIN sessions s ON u.uid = s.uid WHERE s.sid = '233297e29b47acbea2adbcca757625ad' in /home/content/j/o/y/joymelissajoy/html/txdirectory/includes/database.mysql.inc on line 172

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/content/j/o/y/joymelissajoy/html/txdirectory/includes/database.mysql.inc:172) in /home/content/j/o/y/joymelissajoy/html/txdirectory/includes/bootstrap.inc on line 811

Warning: Table 'joy0722804033891.cache' doesn't exist query: SELECT data, created, headers, expire FROM cache WHERE cid = 'variables' in /home/content/j/o/y/joymelissajoy/html/txdirectory/includes/database.mysql.inc on line 172

Warning: Table 'joy0722804033891.variable' doesn't exist query: SELECT * FROM variable in /home/content/j/o/y/joymelissajoy/html/txdirectory/includes/database.mysql.inc on line 172

Warning: Table 'joy0722804033891.cache' doesn't exist query: LOCK TABLES cache WRITE in /home/content/j/o/y/joymelissajoy/html/txdirectory/includes/database.mysql.inc on line 172

Warning: Table 'joy0722804033891.cache' doesn't exist query: UPDATE cache SET data = 'N;', created = 1187988570, expire = 0, headers = '' WHERE cid = 'variables' in /home/content/j/o/y/joymelissajoy/html/txdirectory/includes/database.mysql.inc on line 172

Warning: Cannot modify header information - headers already sent by (output started at /home/content/j/o/y/joymelissajoy/html/txdirectory/includes/database.mysql.inc:172) in /home/content/j/o/y/joymelissajoy/html/txdirectory/includes/bootstrap.inc on line 488

Warning: Cannot modify header information - headers already sent by (output started at /home/content/j/o/y/joymelissajoy/html/txdirectory/includes/database.mysql.inc:172) in /home/content/j/o/y/joymelissajoy/html/txdirectory/includes/bootstrap.inc on line 489

cog.rusty’s picture

Heh, that's why I suggested to upload a fresh settings.php. When Drupal finds your database info in settings.php it thinks that it is already installed and doesn't run install. Instead, it just tries to find the tables (which are not there yet).

joy_m_n’s picture

You're right.
I just changed it back because the other way didn't work, either.

When I installed a fresh settings.php file, it just kept loading and loading and loading until I finally got a 404 not found error.