MySQL TABLES CRASHED BUT STILL WORKING WHEN RESTORED TO MySQL ON ANOTHER SYSTEM, WHY ???

Hi everyone,
I'm a software developer and just started my professional career life, question here i want to ask is ... that few days ago i was at client site to resolve some issue in application deployed by a company that uses MySQL for database, what i was found that there are four MySQL tables were crashed due to low harddisk space issue (I've searched on net that this is a usual problem with MySQL) that then i repaired by using <code>myisamchk</code> command. Error shown by MySQL when these were accessing is <code>[table name] marked as crashed and should be repaired</code>.

ok so this was the background scenario, now what i want to know/ask here is ... as described in above details that these 4 four tables were not accessible becuase they are crashed but I took a backup of this database and restore it to MySQL at another machine then i can access these table easily with no issue/error by MySQL, SO WHY THIS HAPPENS THAT AT ONE SIDE THESE ARE AS CRASHED AND ON ANOTHER THE BACKUP OF SAME DATABASE THAT WAS TAKEN WHEN THESE TABLES ARE CRASHED ARE THEN WORKING FINE.

I really will appreciate any kind of help on this topic Im just asking this for knowlegde and second thing is my boss also asked me the same question

THANKS in Adnvance to all visitors

You said yourself, they crashed because of low disk space. Your new machine most likely has plenty of space, so no issues arise. The table data is fine on the disk, but the server requires disk writes for all kinds of stuff.

A crashed table is for the MyISAM storage engine. MyISAM has two files, a .MYD (for MyISAM Data) and .MYI (for MyISAM Index). When you make a change to your table with INSERT/UPDATE/DELETE the data is flushed to disk, while the index is written to memory and not initially flushed to disk. When a table is marked as crashed, it is generally not the data that is corrupt but the index. The myisamchk -r rebuilds the Index if necessary. A crashed table is generally the result of server crash, however a lack of disk space could cause it.

When you restored the table on the new machine (I assume via a mysqldump) you effectively rebuilt the index that was crashed on the original server.

ok thanks just asked to clear my concept more ... THANKS :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.