Labels
Java
(10)
MySQL
(6)
linux
(6)
INNODB_LOCKS
(2)
INNODB_TRX
(2)
J2EE
(2)
bash
(2)
exclusive
(2)
innoDB
(2)
mountrakis
(2)
processlist
(2)
transactions
(2)
x-locks
(2)
xlocks
(2)
ERROR 1045 (28000)
(1)
Jboss
(1)
Jboss5.0
(1)
Jconsole
(1)
Master
(1)
Slave
(1)
Synchronization
(1)
VPN
(1)
binlogs
(1)
command line
(1)
cook-book
(1)
cookbook
(1)
date
(1)
for
(1)
handy commands
(1)
loop
(1)
michael mountrakis
(1)
replication
(1)
sh
(1)
shell
(1)
unix epoch
(1)
unix timestamp
(1)
while
(1)
Showing posts with label query. Show all posts
Showing posts with label query. Show all posts
Wednesday, 19 June 2019
Retrieving the Posts and Pages from Wordpress Database.
Sometimes shit happens. Client took backup only the Wordpress DB without taking the PHP files. In other words, configuration, plugins, custom templates, skins and images.... just lost. Last Well Known good backup gone with the server.... and what we only got is a Wordpress DB without images. So practically, it would be a better idea to backup one by one pages from browser by clicking Save as.... Just jogging of course...
Now he has to write everything from scratch.
Step 1.
Examine your backup file:
-- MySQL dump 10.13 Distrib 5.5.55, for Linux (x86_64)
--
-- Host: localhost Database: wordpress9
-- ------------------------------------------------------
-- Server version 5.5.55
Step 2:
Go to MySQL and download the exact server version your previous installation comes from. Here is our link: https://dev.mysql.com/downloads/mysql/5.5.html
Install the MySQL temporarily in your PC or a simple VM or anything else.
Step 3:
Create a Database in your server just like the backup specifies:
C:\Users\>mysql -uroot -pmypass
mysql> CREATE DATABASE wordpress9 CHARACTER SET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.01 sec)
Step 4:
Copy your backup file. Edit your backup file
Restore your last backup in the server
C:\Users\>mysql -uroot -pmypass wordpress9 < backup_2019_01_18_1547817726_4347121_wpdb.sql
Step 5:
Create a file called restore.sql with the following query to retrieve your posts, pages and news:
select '<h1>',post_title,'</h1>',post_content, '<hr/> End Post <hr/>' from wp_posts where post_status='publish' and post_type in ('page','post','nooz_release') order by post_name, post_date ;
Step 6:
Run the query command as follows:
C:\Users\>mysql -uroot -pmypass wordpress9 < restore.sql > restored.html
The results are inside restored.html and can be viewed with a browser.
More careful backup next time....
Subscribe to:
Posts (Atom)