HostOnNet Blog

Restore wordpress from backup without phpMyAdmin in MariaDB

Looking for Linux Server Admin or WordPress Expert? We can help.

Today I restored backup of wordpress to another website. Here I am sharing the steps of how I completed the wordpress restore process.

First I created Database in MariaDB.

CREATE DATABASE dbname;

You’ll see this output confirming it was created.

Output
Query OK, 1 row affected (0.00 sec)

To see the database

SHOW DATABASES dbname;

and then created user db user and password

GRANT ALL ON dbname.* TO 'dbusr'@'localhost' IDENTIFIED BY 'password';

Imported the Database backup to newly created Database

mysql -u dbusr -p dbname < /var/www/username/mysql-backup.sql

Updated the urls by editing wp_options table

SHOW wp_options;
select * from wp_options where option_value = 'https://olddomain.com';
update wp_options set option_value = 'https://newdomain.com' where option_id = 1;

Changed the admin password

SHOW wp_users;
select * from wp_users where id = '1';
UPDATE wp_users SET user_pass="PASSWORD" WHERE ID = 1; 

Created password using md5 Hash Generato

After that logged in the admin area and tried to upgrade the wordpress. But got error as

The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions

So changed ownership of folder

chown -R nginx:nginx foldername

Installed Velvet Blues Update URLs plugins in wp admin area and updated the urls in Tools -> Update URLs

Success! Your URLs have been updated.
Results
2280 Content Items (Posts, Pages, Custom Post Types, Revisions)
180 Excerpts
0 Links
18649 Attachments
159 Custom Fields

About Sibi Antony

Bootstrap and Android LOVER. I've been creating things for the web for over 10 years, from the period of flash and table based layout web sites till mobile and tab friendly web sites.
Posted in Wordpress

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.