user234562
user234562

Reputation: 627

WordPress Error establishing a database connection (xampp)

I am using xampp to host my website local. I am making a WordPress site with the MySQL database from xampp.

Now, I bought a new computer and took backup of my WordPress folder. Now when I try to open my WordPress site on my new computer, I get the error: Error establishing a database connection I can image this is because the database that is linked to the WordPress site is not on my new system.

I formatted my old drive so I cannot restore the old database. Is there a work around?

Upvotes: 0

Views: 1017

Answers (4)

Jame
Jame

Reputation: 21

Step 1: Backup your database on the old computer.

Step 2: Restore the database onto the new computer.

Step 3: Run file install in wordpress

Good luck!

Upvotes: 1

Jilani A
Jilani A

Reputation: 168

You need to install your wordpress site again with new database. You already lost it. Always backup your wordpress site. You can backup your wordpress site with this plugin and it's free- https://wordpress.org/plugins/updraftplus/

Thanks
BanyanTheme

Upvotes: 1

Fenil Shah
Fenil Shah

Reputation: 158

If you have your old database file (.sql) then you can just

  1. Run this link from your browser http://localhost/phpmyadmin.
  2. Select Database which you want to upload the SQL file. (If no DB , create new database).
  3. Click on Import option from top menu section and upload you files.

and for taking backup of your database on Xampp 1. Run this link from your browser http://localhost/phpmyadmin. 2. Select Database which you want to take backup of. 3. Click on Export option from top menu section and backup your files.

Upvotes: 2

geonaut
geonaut

Reputation: 379

If your old drive is completely formatted, and you weren't using any sort of Wordpress backup plugin, then no, you won't be able to rebuild the site. Sorry! As well as storing your content (posts / articles), your Wordpress database also stores information on which plugins you were using, so it is an critical part of rebuilding any Wordpress site.

Next time around, you should export your database to a file (eg .sql), so you can import it on your new server/laptop. You would achieve this by either using a Wordpress plugin, or on XAMPP by using phpMyAdmin. You could also do this with 3rd party apps, like SequelPro or MySQLWorkbench.

You should have your images and static assets saved - eg css files, uploaded images, so you have something to start with, if you decide to rebuild your site without the database.

Upvotes: 1

Related Questions