Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 8th Sep 2012, 11:22 PM   #1
nig
Warrior Member
 
Join Date: 2011
Posts: 11
Thanks: 8
Thanked 9 Times in 5 Posts
Default
HELP - accidentally deleted a database table
Share on: 
fb share twitter share gplus share more share

OK, first want to say - I know, how stupid was that! I was deleting database tables for a plugin I no longer need and got trigger happy and deleted the wrong one.

The table I deleted by mistake is wp_links - which is now causing massive errors in my error log.
I have saved database backups - how can I get that one table back into my database.

Please be gentle with me, I don't know much about sql's & phpmyadmin ... but can take simple instructions. Any help much appreciated!
nig is offline  
Unread 9th Sep 2012, 12:36 AM   #2
VIP Warrior
War Room Member
 
timpears's Avatar
 
Join Date: 2008
Location: Vancouver, WA, USA.
Posts: 5,273
Thanks: 884
Thanked 979 Times in 704 Posts
Default
Re: HELP - accidentally deleted a database table
Share on: 
fb share twitter share gplus share more share

First thing I would do is ask my host if they could get it out of the back up. Hostgator backs up my site every Saturday morning and sends me a notice to that effect. If you are now with Hostgator, who every you are with must have a backup schedule.

Tim Pears
timpears is offline  
Unread 9th Sep 2012, 12:39 AM   #3
nig
Warrior Member
 
Join Date: 2011
Posts: 11
Thanks: 8
Thanked 9 Times in 5 Posts
Default
Re: HELP - accidentally deleted a database table
Share on: 
fb share twitter share gplus share more share

Great thanks for the reply. But I don't want to restore the whole database as I did a whole heap of work on the site in between. I only want the one table wp_links restored ... is that possible at all?
nig is offline  
Unread 9th Sep 2012, 12:42 AM   #4
White Hat Marketer
War Room Member
 
Dan Grossman's Avatar
 
Join Date: 2007
Location: Montgomeryville, PA
Posts: 1,546
Thanks: 77
Thanked 775 Times in 267 Posts
Default
Re: HELP - accidentally deleted a database table
Share on: 
fb share twitter share gplus share more share

Yes. Open the backup SQL file and only execute those queries that start with
Code:
CREATE TABLE wp_links
and
Code:
INSERT INTO wp_links
.

The easiest way to do that is to find those lines, and delete all the stuff before and after them; they will be all together and you don't need the rest of the backup file.

Then upload to your phpmyadmin, or just pipe the file in to the mysql CLI.

Improvely: Built to track, test and optimize your marketing.

[SIGPIC][/SIGPIC]
Dan Grossman is offline  
Unread 9th Sep 2012, 12:45 AM   #5
nig
Warrior Member
 
Join Date: 2011
Posts: 11
Thanks: 8
Thanked 9 Times in 5 Posts
Default
Re: HELP - accidentally deleted a database table
Share on: 
fb share twitter share gplus share more share

Um ... execute? Greatly appreciate your help, but I don't understand what that means. Is that in the phpmyadmin area? And do I "cut and paste" it from notepad?
Sorry I am such a dumkopf!
nig is offline  
Unread 9th Sep 2012, 07:47 PM   #6
nig
Warrior Member
 
Join Date: 2011
Posts: 11
Thanks: 8
Thanked 9 Times in 5 Posts
Default
Re: HELP - accidentally deleted a database table
Share on: 
fb share twitter share gplus share more share

I have WP Database Manager plugin installed. Can I go to the "run SQL Query" page in my WP dashboard and create the table there?

It has a CREATE option, but I don't know what to do?

I have found the piece from inside my sql database: CREATE TABLE etc to INSERT INTO .

Would I just paste all of that into that WP Database manager page as is?

Sincerely appreciate any help.
nig is offline  
Unread 9th Sep 2012, 09:14 PM   #7
White Hat Marketer
War Room Member
 
Dan Grossman's Avatar
 
Join Date: 2007
Location: Montgomeryville, PA
Posts: 1,546
Thanks: 77
Thanked 775 Times in 267 Posts
Default
Re: HELP - accidentally deleted a database table
Share on: 
fb share twitter share gplus share more share

Sorry, I don't know what these tools are. You want to run those queries.

Improvely: Built to track, test and optimize your marketing.

[SIGPIC][/SIGPIC]
Dan Grossman is offline  
Unread 10th Sep 2012, 06:18 AM   #8
nig
Warrior Member
 
Join Date: 2011
Posts: 11
Thanks: 8
Thanked 9 Times in 5 Posts
Default
Re: HELP - accidentally deleted a database table
Share on: 
fb share twitter share gplus share more share

Ok thank you for the replies guys :-)
nig is offline  
Unread 10th Sep 2012, 07:07 AM   #9
Warrior Member
 
homeitservice's Avatar
 
Join Date: 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default
Re: HELP - accidentally deleted a database table
Share on: 
fb share twitter share gplus share more share

hello nig,
you have installed WP-DBManager do this first in step by step if no go proceed to the second one and so on...
1. repair database
2. restore database if no go
3. drop/empty tables and run queries

by the way what version of your DB manager? and you WP?

We provide quick and accurate solutions by offering home I.T. service to resolve technological challenges for customers. For more info, please visit us http://www.homeitservice.net/.
homeitservice is offline  
Unread 10th Sep 2012, 08:53 AM   #10
nig
Warrior Member
 
Join Date: 2011
Posts: 11
Thanks: 8
Thanked 9 Times in 5 Posts
Default
Re: HELP - accidentally deleted a database table
Share on: 
fb share twitter share gplus share more share

Thank you. I have the latest version of WP & WP Database Manager.

See, I don't want to re-install the whole database - as I have done a lot of work on the site in the meantime. I only want to re-insert that one, single table: wp_links.

But I don't fully understand the way to do it. I don't know how to run a query. I can see in WP Database manager where to do it - but don't know exactly what to put into the text box.
nig is offline  
Unread 10th Sep 2012, 01:21 PM   #11
White Hat Marketer
War Room Member
 
Dan Grossman's Avatar
 
Join Date: 2007
Location: Montgomeryville, PA
Posts: 1,546
Thanks: 77
Thanked 775 Times in 267 Posts
Default
Re: HELP - accidentally deleted a database table
Share on: 
fb share twitter share gplus share more share

You put the queries you copied out of the backup. You said you found them. The `CREATE TABLE wp_links` and `INSERT INTO wp_links` queries. I'm sure PHPMyAdmin has some tab where you can paste SQL queries in and run them too.

Improvely: Built to track, test and optimize your marketing.

[SIGPIC][/SIGPIC]
Dan Grossman is offline  
Unread 10th Sep 2012, 07:42 PM   #12
nig
Warrior Member
 
Join Date: 2011
Posts: 11
Thanks: 8
Thanked 9 Times in 5 Posts
Default
Re: HELP - accidentally deleted a database table
Share on: 
fb share twitter share gplus share more share

Ok, getting there. You guys rock!...

I pasted the following which is from my database backup, from the start of the CREATE TABLE to the end of the INSERT TABLE into the WP Database manager "Run SQL Query" text box, but it flicked me out to my blog's front page and the table was not added.

What would be incorrect here, please?

(I have allowed permissions temporarily in .htaccess and wp-config.php in case that makes a difference)

CREATE TABLE `wp_links` (
`link_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`link_url` varchar(255) NOT NULL DEFAULT '',
`link_name` varchar(255) NOT NULL DEFAULT '',
`link_image` varchar(255) NOT NULL DEFAULT '',
`link_target` varchar(25) NOT NULL DEFAULT '',
`link_description` varchar(255) NOT NULL DEFAULT '',
`link_visible` varchar(20) NOT NULL DEFAULT 'Y',
`link_owner` bigint(20) unsigned NOT NULL DEFAULT '1',
`link_rating` int(11) NOT NULL DEFAULT '0',
`link_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`link_rel` varchar(255) NOT NULL DEFAULT '',
`link_notes` mediumtext NOT NULL,
`link_rss` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`link_id`),
KEY `link_visible` (`link_visible`)
) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `wp_links`
--

LOCK TABLES `wp_links` WRITE;
/*!40000 ALTER TABLE `wp_links` DISABLE KEYS */;
INSERT INTO `wp_links` VALUES (8,'I DELETED LINK HERE AS NOT ALLOWED/','Techfresh','','_blank','Techfresh','Y',1,0,'000 0-00-00 00:00:00','','','');
/*!40000 ALTER TABLE `wp_links` ENABLE KEYS */;
UNLOCK TABLES;
nig is offline  
Unread 10th Sep 2012, 07:47 PM   #13
White Hat Marketer
War Room Member
 
Dan Grossman's Avatar
 
Join Date: 2007
Location: Montgomeryville, PA
Posts: 1,546
Thanks: 77
Thanked 775 Times in 267 Posts
Default
Re: HELP - accidentally deleted a database table
Share on: 
fb share twitter share gplus share more share

Perhaps the "WP Database Manager" does not let you run multiple queries at once. Don't use it.

Improvely: Built to track, test and optimize your marketing.

[SIGPIC][/SIGPIC]
Dan Grossman is offline  
Unread 11th Sep 2012, 07:24 AM   #14
Social Apps Made Easy
War Room Member
 
FirstSocialApps's Avatar
 
Join Date: 2012
Location: Mooresville, NC
Posts: 913
Thanks: 231
Thanked 259 Times in 213 Posts
Default
Re: HELP - accidentally deleted a database table
Share on: 
fb share twitter share gplus share more share

You can run the querys from within PHPmyADMIN yes. In the SQL tab.

FirstSocialApps is offline  
Unread 11th Sep 2012, 08:07 PM   #15
Warrior Member
 
Join Date: 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default
Re: HELP - accidentally deleted a database table
Share on: 
fb share twitter share gplus share more share

I dont think you will get your table back if you dont hve a backup file, so you should create a new table with data in it.
websamtron is offline  
Unread 11th Sep 2012, 08:31 PM   #16
White Hat Marketer
War Room Member
 
Dan Grossman's Avatar
 
Join Date: 2007
Location: Montgomeryville, PA
Posts: 1,546
Thanks: 77
Thanked 775 Times in 267 Posts
Default
Re: HELP - accidentally deleted a database table
Share on: 
fb share twitter share gplus share more share

Originally Posted by websamtron View Post

I dont think you will get your table back if you dont hve a backup file, so you should create a new table with data in it.
Why is this forum so infested with new accounts that read nothing and therefore help no one?

Improvely: Built to track, test and optimize your marketing.

[SIGPIC][/SIGPIC]
Dan Grossman is offline  
Closed Thread


Bookmarks

Tags
accidentally, database, deleted, table


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 05:27 AM.