Some days ago, you might be seeing an error “Error establishing a database connection” on my homepage while visiting my blog at www.inavneetsingh.com/blog/. The most surprising thing is that, this error appearing even on my main URL of my website www.inavneetsingh.com , which is forwarded to my WordPress blog directory ../blog where there is no connection of WordPress Database.
Well this wasn’t fault of my hosting or domain provider its just mine!
Why i got database error on every of my website page?
While updating my hosting package i accidentally click on Delete Database button, i don’t know what i am thinking at that time but i did click on that stupid button. Just after that i try to login into my WordPress account and then i start getting Database error while visiting on any of my website page. It happens because i deleted whole database. I panicked seriously, in my mind for every seconds there is thought running if i didn’t get my WordPress blog then? what if every posts, categories, tags i wrote is lost and will not be recover? I have written around 50+ posts on blog, if i lost any of single posts it’s biggest nightmare for me.
How i get back everything on my WordPress blog?
In this condition people can either call their friends who know about this, or call your hosting provider who know everything regarding this. I suggest you to call your hosting services, because they know better than anyone cos everyday some people face this problem they gotta solve it. If you are hosting your website on trust-able hosting provider then they will surely help you getting out of this problem.
I broke down few points to getting my WordPress blog and remove Database error:
1. Remember at this point i don’t even have a running hosting plan on my blog, so i gotta update first.I don’t want any other mistakes so i did call my hosting provider, they were pretty nice to me and told me how to update hosting package easy in 3 steps. I did update it easily.
2. After updating my hosting package, i thought i will get my posts and everything back, but this didn’t get any of single posts, all i got was a brand new hosting c panel 00 MB Disk space.
3. I panicked more!! i sat and think, what i will do now? When you sit calm and think there is always a solution of every problem. so i found mine, i remember that once i installed “WordPress Backup To Dropbox” plugin which used to backup everything on my dropbox which is related to WordPress site, all data, images, categories, tags and .sql file which is the main source of getting all posts back.

Please Note: Your SQL dump file will always be backed up regardless of what is selected below.
Your .sql file is always backup ![]()
4. All my tension just gone, after this i login into my dropbox folder, luckily i got backup file on my WordPressBackup folder. Now all i have to do is to import backup.sql file into my phpmyadmin database. i logged into my c panel and try to import backup.sql file but what the fish! i am still getting and Database error.
5. I try to import backup file in localhost but no success. Instead of importing, it created a new WordPress database which is not same as i created using Fantastico De Luxe.
You can see below, i want to import backup.sql into “inavnojc_wrdp” but instead to importing into main database it create a new one name “inavnojc_wrdp2″
6. I later found why PhpMyAdmin not letting my update backup.sql because of settings in backup.sql file. As it create new database.
Open you backup file and move to the line which says CREATE DATABASE in my case it is on the line number 7, this CREATE DATABASE used to create a new database instead of using the same you defined.
All you have to do is to delete this line and on line 8 change USE inavnojc_wrdp2; to whatever your database name is.
01 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";02 03 --04 -- Create and use the backed up database05 --06 07 CREATE DATABASE inavnojc_wrdp2;08 USE inavnojc_wrdp2;09 10 --11 -- Table structure for table `wp_commentmeta`12 --13 14 CREATE TABLE `wp_commentmeta` (15 `meta_id` bigint(20) unsigned NOT NULL auto_increment,
After updating, your code should be look like this:
1 −−2 −− Create and use the backed up database3 −−4 5 USE inavnojc_wrdp; --change 'inavnojc_wrdp' it to your database name.
7. I again try to import my database, this time BINGO!! Everything on my WordPress blog is back as it was.
What i learn after deleting WordPress database and recovering it??
Always use backup WordPress using backup plugins, to keep your database safe, no matter what happens to your database, these plugins are these are the best plugins available for your WordPress blog:
WP-DB-Backup : create backup of .sql files and capable of sending backup file to your email or download onto your computer.
WordPress Backup To Dropbox: Automatically backup Everything in your WordPress site into dropbox (Recommended)
I write these posts because there are some of you who face the same problem and got panic, remember getting panicking is not a solution there is always a way to WIN
If you have any question or anything please comment below, i will really appreciate it




it’s nightmare for every blogger & had experience of such situation & only one thing can save us Backup!!
TechGopal recently posted..Installation Android 4.1 Jelly Bean Dependent ROM on Verizon Galaxy Nexus
Yes, it’s the worst thing any blogger can think about.
Thanks for the comment Gopal, Keep visiting
I had a similar issue when i deleted a post on my website accidentally. However not aware much of wordpress and backup plugins at that time. Right now my knowledge on wordpress plugins is better
Oh, so better install some Backup plugins to keep running your website
Hey congrats for getting everything back in place! I was just wondering whether I should go for a premium backup plan or use the free ones available. What do you say?
Mukesh @ geniuskick recently posted..7 Indian Startups (Websites) Useful For Students
Thanks a lot
Go for a premium if you have enough budget, otherwise free is too good.