top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to restore files and database in Wordpress?

0 votes
431 views

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 wp-admin.zip in your public_html directory.
Download the wp-admin.zip 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 wp-admin.zip 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 wp-admin.zip file there.
Once uploaded, use the Extract feature in the cPanel and decompress wp-admin.zip 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 wp-admin.zip 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 (
        id INT NOT NULL AUTO_INCREMENT,
        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:

<?php
/*
Template Name: Student
*/
get_header();
?>    
<?php echo "google";?>    
<?php

    if($_POST['Submit'])
        {
         global $wpdb;
         $name=$_POST['aname'];
         $roll=$_POST['aroll'];
         $dept=$_POST['adept'];
              if($wpdb->insert(    
                  'std', array(
                               'name' => $name,
                               'roll' => $roll,
                               'dept' => $dept
                               )
                               ) == false) wp_die('Database insertion failed');
     else 
          echo "<p>Database insertion successful</p>";  
?>
<?php
}
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" />
</form>
<?php
}

{
}
?>
<?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 ?>
</span></a>
<?php endforeach; ?>
</span>

<style>
.term-links .category2 {
display: inline-block;
font-weight:bold;
</style>

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

...