Recover my database structure from from files - mysql

It was my habit to uninstall easyphp without losing my database...But this time, I've uninstalled my easyphp and re-installed it again, but when I tried to view my database, I see that all tables have been lost.
Actually, my tables are all empty, because I've just finished the database conception and I did not yet begun the project online.
But the tables are about 40 table, and I don't want to recreate them again.
so I've viewed my mysql directory, and I see that *.frm files with the names of my tables.
How can I recover my tables structure (not data) from those *.frm files?

I have tried and tried to do this after reading lots of suggestions on the Internet, but the answer is no.
Either find an earlier backup or, as I had to do, redo all your tables. This is taking me about 2 hours, but I'm going to back up my files a lot more often now :)
Use this as a learning experience.

Related

Need to recover MYSQL data

An important table in one of my clients databases has been totally corrupted. All of our backups are woefully out of date. Is there any sort of restore point or something? Does IIS have any restore points?
EDIT: Excuse me, not corrupted, overwritten. Bytewise it's fine, values just overwritten with garbage data.
Have you tried REPAIR TABLE? If so, then you are probably out of luck. IIS doesn't backup MySQL data, nor does MySQL do it on its own. So, if your only backups are outdated, you may be up the creek.

how to save or retrieve data from mysql when we cannot open it anymore?

I am trying to save or retrieve data from my co-workers computer. Her MySQL instance does not work anymore (cannot figure out the reasons). I would like to know if there is a way to save all the data from the databases present in her computer.
Any suggestions on how to save the data, and maybe re-install MySQL again?
You can copy the tables to another computer with a working MySQL instance, as long as the floating point format is the same on both computers (see this page for reference, covered in the first paragraph).
As long as you copy the .frm, .myd and .myi files somewhere safe, you can also try reinstalling MySQL and see if that works for you.
First of all, errors may be recoverable. If you do not have ability to recover from errors, you can try to make a plain copy of MySQL data. BUT! If tables used InnoDB engine, that will be not so easy and chance of recovery will be not so big.

Can I move MySQL table to a second drive?

I am having I/O related performance problems that would be solved if a few relatively small tables were running on a SSD. I can't move the entire DB to SSD because it is much too large.
I thought this was possible (map specific tables to different drives) but a tech at my managed hosting company says that the entire DB needs to be in a single directory. Is this correct? If he's wrong, can someone point me somewhere with basic instructions on how this is done? Or even provide the instructions here?
When you create a MySQL table you can specify the data directory and index directory.
Have a look at http://dev.mysql.com/doc/refman/5.1/en/create-table.html
So, to answer your question, you could create a new table in the different directory and migrate your data there.

Recover data from a dropped/truncated MySQL table

I just spend a few hours putting together a table full of data, and just decided to drop a WP installation in the same database. I expected WordPress to leave my table as it was and simply add the WP_* tables, but apparently the install wiped my database before installing the wordpress tables.
I have full access to the server root. Is there any way for me to recover this table?
I'm sorry, but that can't be done. Once a table is truncated or dropped everything is gone.
The only way to get it back would be recovering the database files from the disk, but that is not very reliable. To do that, you first have to find out where the MySQL's data files are (see this), then try using a file recovery tool to get them back. Good luck.
Another one who learns to back up the hard way.
If tables were MyISAM, then I agree with NullUserException - you can't recover the tables. Well, the chance is very slim.
If InnoDB - check out my presentation on slideshare - there is a tool to extract records from raw bytes stream - percona data recovery toolkit. There are examples in the presentation, your scenario is pretty much typical.
UPDATE: Data recovery toolkit moved to GitHub

MySQL table recovery from crashed server

I managed to wipe a server by mistake but PhotoRec was kind enough to recover the .frm and .myi files from the hard drive. I now have a desktop set up with the same version of MySQL to recover the data but my question is: what do I do? I have about 160 of these files. I haven't yet reinstalled the server in case I need anything else.
Also, as I'm using PhotoRec, it doesn't provide the original filenames. If this is important, how can I get the raw data out of the files and manually rebuild the database?
Edit: I managed to get ahold of the PhotoRec source and add the capability to recover the .myd files (which a bit of digging reveals to be the actual data files), but I can't get the thing to compile, and it ain't because of my mods! Can anyone help with a 'No rule to make target' error in PhotoRec? file_http.o's the culprit.
Thanks,
Rob
MYI files are useless, these are files with secondary indexes, not your data.
PhotoRec is a nice tool, I used it a lot for multimedia recovery etc. Although it claims MYD support it never worked for me. I doubt it possibly can extract MYD files.
I dont belive you can, photorec does not support MYD, im doing an attempt with ext3grep but it always segfaults.
just posting this so someone doesnt spend time better spent on using photorec for this purpose.