MySQL structure lost. Rebuilding it automatically ?
#1

Hey,
I recently had some problems with my hoster and I ended up loosing database structure. So of course I could go through my whole script and search for all the tables and fields which need to be created but that would need forever. Is there any way in MySQL to create a table with it's field automatically if they don't exist without using CREATE TABLE ?
For example: I'm using a query which should insert stuff into a field. Field and table aren't existing. Now as they aren't existing they should be created and my stuff should be inserted.

Thanks in advance.
Reply
#2

Sadly, no. Unfortunately had that happen myself when I tried to open a virtual machine after reinstalling Windows. The virtual drive somehow got corrupted and the database structure (three tables at the time only, luckily) got lost. Lesson learned: make backups regularly.
Reply
#3

Well, the thing is I saved the backups on the VPS which got reset due to a server upgrade. The last backup I've saved locally on my PC is from months ago.
I thought about letting the server read the mysql.log line per line and if there's a missing table/field error I could format a CREATE TABLE query with the required table name from the log file.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)