admin管理员组

文章数量:1122846

I have a database backup and entire site folder backup of a wordpress site. I want to setup it in my localhost. These are the steps I followed.

  1. Create a database
  2. Import the database_backup.sql
  3. Open the wp-config.php and edit the following details

define( 'DB_NAME', 'contents_wp' );

define( 'DB_USER', 'root' );

define( 'DB_PASSWORD', '' );

define( 'DB_HOST', '127.0.0.1' );

But I cannot log in to the admin panel. It redirects to the live site. How to solve this? What I am doing wrong here?

Any suggestions will be appreciated.

I have a database backup and entire site folder backup of a wordpress site. I want to setup it in my localhost. These are the steps I followed.

  1. Create a database
  2. Import the database_backup.sql
  3. Open the wp-config.php and edit the following details

define( 'DB_NAME', 'contents_wp' );

define( 'DB_USER', 'root' );

define( 'DB_PASSWORD', '' );

define( 'DB_HOST', '127.0.0.1' );

But I cannot log in to the admin panel. It redirects to the live site. How to solve this? What I am doing wrong here?

Any suggestions will be appreciated.

Share Improve this question edited Feb 8, 2019 at 23:58 fuxia 107k38 gold badges255 silver badges459 bronze badges asked Nov 27, 2013 at 10:05 SukeshiniSukeshini 1751 gold badge3 silver badges9 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 1

Before import database_backup.sql. You have to replace server url with your local url in sql. for example: you took backup from abc.com , and your local url is localhost/abc .then open database_backup.sql and find and replace abc.com with localhost/abc. Save and import now.

I prefer the approach of Charles as that is a lot easier, safer and useful approach. Still you can follow as mentioned by Saifur.

I will suggest one point here i.e. not to replace the data directly in the sql file. This is because wordpress stores data in terms of serialized manner. So even though you replace the data correctly, it may not work 100%.

In this case you first create the database and import the sql file. Then use a script to make a search and replace directly in the database. One such useful script is this one http://interconnectit.com/products/search-and-replace-for-wordpress-databases/ I have used this many times and it has always worked.

本文标签: local installationHow to setup a wordpress backup in localhost