top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

How to restore files and database in Wordpress?

0 votes

I transfer my wordpress website to a new server. I didn't know about appropriate way of taking backup. I just copied all files inside public_html and exported database from phpMyAdmin. Now I am trying to restore files and database.

I copied all files in public_html and made database and imported. Now I am getting HTTP Error 500. Anybody can help me how can I restore these files without losing data.

posted May 29, 2017 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

If you're doing site transfer using cPanel, then you need to keep the following in mind. I may also suggest to use a plugin like Duplicator or so if doing manually is too much of work for you. Let's see how you can do a manual transfer.

Current Server

1. Assuming all your files are in public_html directory, compress them all using cPanel compress feature. Once done, you will something like in your public_html directory.
Download the file in your computer.

2. Visit phpMyAdmin and locate your site DB. Let's call this wp_current_server. On the database screen where you can see all your DB tables for your wp_current_server DB, hit Export button and hit Go. No other step is needed there.
After a few seconds an SQL file will be downloaded on your computer.

So, now you have all your files in the and DB in the wp_current_server.sql file.

New Server

3. Login to your new server cPanel and locate public_html directory. Assuming the entire directory is empty, just upload your file there.
Once uploaded, use the Extract feature in the cPanel and decompress file. After that you will see all your WP folders and files like wp-admin, wp-includes, wp-content and so.

Now you can safely delete your file from your server.

4. Move to Database section in your cPanel and create a new DB. Give a name to your DB, create a DB username and add a password. Keep note of all them in a text file like notepad. You will need them all.
Do make sure you give all the privileges to your DB user.

5. Now hit the phpMyAdmin button and locate your newly created DB. It will be empty of course.
Look for the import button in the top bar and import your wp_current_server.sql there. Again keep the configuration default. Wait for a few seconds before the import is complete. If you domain name does not change in your new server, your job is done there. Move to the # 6 below

6. In your public_html directory, locate the wp-config.php file in the root. Open this with and find the constants like db_name, db_username, db_password. Fill in these all correctly from your saved notepad. Save the file and then visit your site. You're done.

answer Jun 6, 2017 by Anand Huded
Similar Questions
0 votes

I want to create a database table with a column corresponding to the time in my wordpress site, so that I can save user actions into this table and know when they did it.

Creating a table:

$sql = "CREATE TABLE IF NOT EXISTS $table_name (
        actiontime NOT NULL DATETIME,
        PRIMARY KEY (id)
    ) $charset_collSate;";
    require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
    // execute the query
    dbDelta( $sql );

Is this correct?

I would want a time stamp such that I can get the difference on minute/second intervals.

0 votes

I am trying to make a custom form and insert into the database but when I click submit nothing happens. Please help me. I did research and changed my code but still same result. I don't know why.

This is the code:

Template Name: Student
<?php echo "google";?>    

         global $wpdb;
                  'std', array(
                               'name' => $name,
                               'roll' => $roll,
                               'dept' => $dept
                               ) == false) wp_die('Database insertion failed');
          echo "<p>Database insertion successful</p>";  
else //else we didnt submit the form, so display the form
<form action="" method="post" id="addcourse">
<label> Student Name:<input type="text" 
name="aname" size="30" /></label>
<label> Roll:<input type="text" 
name="aroll" size="30" /></label>
<label> Department:<input type="text" name="adept" size="30" /></label>
<br />
<input type="Submit" id="addcoursesubmit" value="submit" />

<?php get_sidebar(); ?>
<?php get_footer(); ?>
0 votes

I want to display all the existing categories in my Wordpress page in the bottom of the content and the selected category will be in bold style, as follows:

For example, for an existing post if I selected category2 of 3 existing, then it show like this

category1 category2 category3

<div class="entry-meta">
<span class="term-links">
<?php foreach ( get_the_terms( $post->ID, 'category') as $term ) : 
<a href="<?php echo esc_url( get_term_link( $term->term_id ) ) 
?>"><span class="<?php echo $term->slug ?>"><?php echo $term->name ?>
<?php endforeach; ?>

.term-links .category2 {
display: inline-block;

In the above code only display the selected category, not showing the all category. How can I do this?

Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.