0

Before installing a plugin, I forgot to do a proper backup of my website and now all I have is a SQL file, which is supposed to have all the contents of my website, with the following heading:

-- phpMyAdmin SQL Dump
-- version 5.1.0
-- https://www.phpmyadmin.net/
--
-- Host: 31.11.39.69
-- Creato il: Set 13, 2023 alle 13:08
-- Versione del server: 5.7.35-38-log
-- Versione PHP: 8.0.7

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `Sql1598566_1`

Is there a way I can recover at least all the posts of my website form one such file.

Note: I'm no expert user, so I would be grateful of answer which do not assume a big developer backgruound knowledge.

2
  • 1
    Dont know of a sql2wxr converter. Try setup a new site locally with this .sql file, using etc/hosts to use it with current domain, then export posts from Tools as a .wxr file
    – birgire
    Jan 2 at 22:22
  • can you edit your question to be more specific? You want to recover posts? Do you need to de-duplicate? What about post meta? Post terms/categories/tags? If you're using PHPMyAdmin to dump the database have you considered dumping just the post related tables instead of everything?
    – Tom J Nowell
    Jan 4 at 14:54

1 Answer 1

2
+25

This definitely is possible. You won't be able to get your media back with just the sql file but you can get your content.

Assuming this is your content and you have a proper admin account this is fairly easy.

Install a fresh version of WordPress (on a web-server or locally).

In phpMyAdmin. Delete the content of your new site database. Import the new SQL file into the database. (you may want to check to make sure that your table prefix on the import tables likely it's wp_. This needs to match what you have set in your wp-config.php file).

In your files (ftp?) Wp-config.php Make sure that table prefixes match.

Add these 2 lines:

define('WP_SITEURL', 'https://example.com');
define('WP_HOME', 'https://example.com');

Set the example.com to the url of the new hosting (or local IP address).

Go to the site on the new url or IP and login as usual. The site isn't going to look pretty but you should be able to get in.

You may find some errors if you have required plugins or a custom theme. So if that happens check your error log and see what is causing the problem.

If these are simple posts, you can go to tools/export and choose to export the content that you need.

If the posts were made with a builder you're going to get all the builder content/code in the posts, so you'll need that plugin when you import into a new site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.