Reputation: 2683
I have to update (move) actual database (exported as .sql
from phpMyAdmin) to new one (already imported, same as old database). Problem is that, when I update file wp-config.php
to new database (I just updated dbname, user, password and server), then it show up installation. When I set it back to old databse, it works OK. So, there is something that I need to update in DB? It seems like there would by any option about installation? Not sure, because new databse is well-filled.
Upvotes: 0
Views: 163
Reputation: 90
You can use wp migrate db plugin to migrate you db for new server , after installation it require new server url and absolute path after that you and get original db to import .
Upvotes: 0
Reputation: 11670
So there is this neat tool I like to use when migrating the entire installation that I've developed locally.
Say you've developed everything locally, and even put the content in. Naturally WordPress will populate database with local links - something like
http://localhost/wp-content/uploads....
But when you move this to a new WordPress installation (clean), you cannot just import the exported .sql
database, because it contains the old links with your localhost in it.
So that's why you first copy your old installation to the new server, then import the database, and then create a folder called sr
where you put in the aforementioned script.
Now it's important not to open the newly copied WordPress installation once you've imported the database, because you'll get mixed links, and it could get messed up here.
Instead go to the /sr
folder on your live site
http://www.yoursite.com/sr
And you'll see a search and replace screen.
There, just change
localhost -> www.yoursite.com
or whatever the equivalent to your localhost might be, in my case it's usually IP address of the test server I am developing.
Your database details like name, username and password should be pulled from the wp-config.php
file.
Then just click dry run. This will show you all the replaced links in the database. Then you can inspect to ensure that you've correctly replaced the links - you only need to change the 'base' of the link. The path to uploads folder, for instance, should remain the same (remember, you've copied the entire wp-content
folder to your live server).
If you think it's ok, do a live run, and let the script replace the links. After it's done delete it from the server - the entire /sr
folder. Because if you leave it, someone could mess up your database.
After that, you can log in to your WordPress and all the content should be there exactly as you've left it on your localhost.
Hope this helps :)
Upvotes: 1