user3046061
user3046061

Reputation: 353

MySql weird behavior on databases with the same name

I have a database that I create through phpMyAdmin. Then I update it by creating tables in it via a script. All fine til now, then I use it. Two days later I drop this database altogether. Then I create another one with a different name, create something in it as well. Drop it too. Then I create a database with the same name as the first one, again creating tables in it. I leave it that way to find out that the next day I login I get the first database (with its contents) rather than the thing that I expected.

This type of weird behaviour happens no matter how you turn it. The same name is not the problem I think since I know it can happen with databases that carry different names. (I've tried it)

Basically it's like this thing forgets about it's state. What is happening? Any ideas? This thing is driving me nuts since I can't do anything without fearing that I lose data.

I'm using windows with Zend Server. I am NOT accidentally dropping tables or something like that.

EDIT: It seems that an immediate restart does not have any effect (meaning it keeps things as is, the random changes happen only after a certain period of time (more than a day)

Upvotes: 0

Views: 460

Answers (1)

Mihai Stancu
Mihai Stancu

Reputation: 16107

Databases are stored on disk as folders containing:

  • one file describing the structure of each table
  • another file containing all of the tables' rows
  • one file for each index/key you define
  • some files (just allocated blocks) intended to allow storing large data such as text-columns or blob-columns which do not reside in the tables' rows (the rows only have a reference to where the blob resides).

When dropping a table the OS deletes some files. When dropping a database the OS deletes a folder.

It is possible (though very unlikely) that the database folder wasn't correctly deleted in the first place -- be it a permission issue on how you installed your server or a server bug or a phpMyAdmin bug.

Upvotes: 1

Related Questions