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.
So there is this neat tool I like to use when migrating the entire installation that I've developed locally.
Search Replace DB
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 :)
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 .
Related
I thought I followed the steps to migrate my WordPress site over to a new host correctly but when I navigate to the new site I am getting redirected to the WordPress installation page. Here was my process:
ZIP'ed up all of the files of my old WordPress site
Exported the MySQL database
Uploaded and unzipped the files on the new host
Imported the MySQL database on the new host
Changed the database connection information in the wp-config.php
Changed the siteurl and home in the database options table
Obviously I am missing something but it is not jumping out at me as to where or what I have overlooked.
At first glance you have done enough it probably should load. Looks like the wp-config is invalid or missing if it's wanting to do a new installation from scratch. Check file permissions and server logs. Use wp cli to try and verify parts. E.g. wp db cli will try and connnect to the DB, so that should fail if the DB connection isn't right (quite a likely cause) and wp shell will give you a PHP console with WP laoded - I find this often prints out useful debugging info if it fails.
However, am I right in deducing from your "Changed the siteurl and home in the database options table" that you migrated not only to a new host, but a different domain as well? In that case you need to change much more in the DB than just those two settings. WP stores all internal links as absolute URLs for example. I would again use wp-cli. The following command is fairly powerful and wide-ranging, so think through your values, but I use it for this kind of migration:
wp search-replace 'old.domain.name' 'shiny.new.domain.name' --all-tables
If it's a multi-site installation, there's a constant in wp-config.php for the default domain that needs updating too
I need mention that I had google search the solution before post at here.
I move my wordpress site to another domain and different server.
wp_config.php edited; database, database username, passwword, and host all changed. table_prefix remain the same because i use the same one.
wp_posts and wp_option i had changed too.
I still got this error message anyway.
You do not have sufficient permissions to access this page
Anyone know what happen and how to fix this ?
wp-admin can't access after moving
If you are moving your domain without changing the Home and Site URLs of your WordPress site you can follow the below guidelines as prescribed by the wordpress codex.
If database and URL remain the same, you can move by just copying your files and database.
If database name or user changes, edit wp-config.php to have the correct values.
If you want to test before you switch, you must temporarily change "siteurl" and "home" in the database table "wp_options" (through phpMyAdmin or similar).
If you had any kind of rewrites (permalinks) setup you must disable .htaccess and reconfigure permalinks when it goes live.
EDIT (if your site url has also changed, well i am only phrasing from the codex site)
Moving a website and changing your domain name or URLs (i.e. from http://example.com/site to http://example.com, or http://example.com to http://example.net) requires the following steps - in sequence.
Download your existing site files.
Export your database - go in to mySQL and export the database.
Move the backed up files and database into a new folder - somewhere safe - this is your site backup.
Log in to the site you want to move and go to Settings > General, then change the URLs. (ie from http://example.com/ to http://example.net ) - save the settings and expect to see a 404 page.
Download your site files again.
Export the database again.
Edit wp-config.php with the new server's mySQL database name, user and password.
Upload the files.
Import the database on the new server.
When your domain name or URLs change there are additional concerns. The files and database can be moved, however references to the old domain name or location will remain in the database, and that can cause issues with links or theme display.
If you do a search and replace on your entire database to change the URLs, you can cause issues with data serialization, due to the fact that some themes and widgets store values with the length of your URL marked. When this changes, things break. To avoid that serialization issue, you have two options:
Only perform a search and replace on the wp_posts table.
Use the Search and Replace for WordPress Databases Script to safely change all instances.
Make sure that the web server is allowing you to view the page itself, and look in the httpd.conf or .htaccess file for the directory that the main Wordpress script lives in.
Make sure that the Wordpress files have the correct permissions. If you just copied them over, then the user that needs to accesses them (apache on many typical LAMP installs, but yours may be different) is able to.
If you have already copied all your files and moved all of it to the new directory, then all you need to do is set your site url, home url.
So for example, if you are working on wordpress locally, you might have had your original URL to something like this:
http://localhost/wordpress
and your new URL might be something like this:
http://wordpress.local
In the case above, you would need to modify your settings in the database.
Database settings:
Go to the wp_options table, and look for the column named option_name, look at the field that says siteurl and home. You will notice that next to them in the option_value field you had your old URL. Change this to your new URL, and you should be good to go.
Hope this helps.
One of my client's site was taken down by hosting as it was sending spam, the site was working fine before it was taken down by hosting, I downloaded the wp-content folder from Cpanel and full dump of database. When I run the site at localhost, it shows the blank page on all directories. When I use the dumped database, it goes blank but when i change it to fresh WP database, the sites looks fine, so it means there is some problem or mis configuration on database? I started debugging manually and found that the file wp-blog-header.php is not getting this file
require_once( ABSPATH . WPINC . '/template-loader.php' );
Because I added echo "Oh God why?"; in template-loader.php and it was not showing the result while with the fresh integrated database, it shows the result.
Can someone please give suggestion that what could be the problem in database?
Your live WP site and your local one will (should) use two separate databases.
In your local phpMyAdmin, make sure you've imported the exported database from the live site.
In your wp-options table, change siteurl to http://localhost/yourpath/toWP.
This should be pointing to your actual
Wordpress folder.
Locate the wp-config.php in your actual WP folder, and make sure the WP_HOME, WP_SITEURL, DB_NAME, DB_USER, DB_PASSWORD, and DP_HOST
All of this has to match up to your local setup, otherwise it will fail (WSOD).
If this doesn't work, it's possible the person that set it up changed some things to make it hard to maintain without him/her. I've seen it done. Personally, I detest WP for things other than blogs. It has a lot of security problems, constantly needs updates, and allows people that really shouldn't be doing web design to toss something together with templates and call it "professional". Good luck!
You are basically changing the domain of your WordPress installation from www.example.com (the original domain) to www.example.local (your localhost).
I usually use this procedure to move WP from a domain to local:
Download from WordPress site the corresponding version of WP and install it on local.
Overwrite the new db with your backup
Change wp-config.php to point to the backup db (only if config changed, i.e. table prefix)
Follow one of the many guides to move WP to a new domain. Example 1, Example 2 and change the db fields to your local domain (www.example.local).
Restart your local apache
It should now be ok to login and regenerate permalinks.
I am pretty new in WP (I came from Joomla) and I have the following problem trying to import an old WP blog (made using WP 3.5) on my local web server.
I have put the old blog foder into my www Apache directory and then I have imported the database on my local MySql DB.
After, I went into the wp_options DB table and I have change the value of the option_value field related to the rows home and siteurl putting in them the correct address (on my localhost web server)
Ok, it's seem to work fine: I can see my website and the articles on it but now I have the following problem:
If an article contains an image, I can't see this image and if I open it in the browser, I get the the following error message: 404 Not Found
Not Found
The requested URL "/it/wp-content/uploads/2012/10/Andrea-Alfieri-chef-bassa3.jpg" was not found on this server.
And in the browser address bar I have the following wrong URL:
http://www.myOldWebSite.it/it/wp-content/uploads/2012/10/Andrea-Alfieri-chef-bassa3.jpg
It is wrong because it is related to the old website URL and not to my localhost website.
I think that must be some wrong settings on my database and that I have to change it but I don't know what I have to change
Can you help me? Some ideas?
Tnx
Andrea
Three things to try. change settings->permalinks to default - you can change it back later.
also in settings->general there is a fields called Wordpress Address and Site Url
then open your db.sql file in a text editor like sublime text or notepad++ and do a search and replace of the old url to the new local url. Then re-import the edited db.sql file into the the database on the new host.
This has worked for me in the past when moving WP from one host to another.
In database in table of posts (example: wp_posts ) guid is the url of specific image
you can update this table :
UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://localhost');
I hope to help
You seem to know what your doing in terms of migrating your blog.
I would assume that if you went in to the settings->general section, both the URL's will match the new URL of the local server. Judging by what you have mentioned in the question.
Providing when you access the blog and then access the Dashboard the URL remains that of the local server then ,most likley everything is as it should be.
Another thing you can try which I have done before to resolve issue when migrating is to use the Wordpress search and replace plugin. This simply checks all tables for any instances of the old URL and replces this with the new one.
Make sure to backup the database before using this tool. Here is the URL for the plugin.
http://wordpress.org/plugins/search-and-replace/
Hopefully this will be of some use to you.
I am developing a wordpress site. I uploaded the files(wordpress) to my live host. So my new live url site for my wordpress like this sample url http://mywordpress.com/, the display seems to be fine, but when I start browsing the menus page will be redirected to my local server, instead of http://mywordpress.com/about-us/ it went to my localhost like http://localhost/mywordpress/about-us
So when I checked the page source all the links including the stylesheet is link to my local. even though I use this code
<link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet" type="text/css" media="all" />
Its kinda weird... but anyone knows how to configure this?
It sounds to me like your database may be using old values for your url's.
For a quick solution that may or may not solve your issue, try http://www.velvetblues.com/web-development-blog/wordpress-plugin-update-urls/ . It's a great plugin. If not... here are my bullet proof instructions for transferring from local to online.
I've migrated from local to online hundreds of times and I think most tutorials on wordpress migration are overly complex. Here's my method (assuming you already have a fresh wordpress installation and database)
Go to phpMyAdmin for your local server and export your database (but not as a file)... just get the straight SQL text and copy it.
Paste that code into dreamweaver, text editor, coda or any plaintext word processor that can do a search and replace. Then search for "http://MyOldWordpressUrl.com/wordpress" (make sure there is NO slash after the final directory) and replace with "http://MyNewWordpressUrl.com/wordpress". Obviously don't include the quotation marks. Make sure your old wordpress URL is correct. You can double check in admin -> general settings.
Get into your control panel for your online hosting and go to the database for your new wordpress install (this should be a brand new installation where you haven't yet created any posts or input any data-- just what wordpress gives you). Export the database and save it as a file (just in case). Now drop all the tables. Click YES when it asks you if you're sure. Then click on the SQL icon (should be in the upper left hand corner of the left sidebar). This should open a new window. Now paste in your code from step 2 and click GO.
Transfer your theme folder via FTP.
Right now you should go to the new wordpress install's wp-admin. Your same User Name and password will apply. Go to "add a post" and add any image from your computer... wait for it to upload, now delete it. This step is to have the server create the uploads folder to be 100% certain is registered by wordpress and set to the correct permissions. I've wasted hours before by transferring the uploads folder directly by FTP, so don't do it.
Step 5 created an uploads folder in FTP, now you can drag and drop the contents of your uploads folder (ie 2008, 2009, 2010, 2011 + subfolders) into the uploads folder. There should be nothing in it except an empty folder (because you deleted that file in step 5), so it's fine to overwrite if it warns you.
The only remaining step is to transfer your plugins. You can do it via FTP, although it's probably faster to add them directly through the Wordpress admin via "add plugin" and search + install.
Oh yeah, now go to permalink settings and click "default", update, then choose whatever you want-- you need to refresh permalinks to.
That's foolproof... but you have to be somewhat familiar/confident using PHP myadmin. Although I've founds some widgets do not transfer via this method, so you may have to drag and drop some widgets again (appearance -> widgets) after the transfer.
For clarification on step 1 and step 3, see the diagrams here: http://webdesignerwall.com/tutorials/exporting-and-importing-wordpress ... but the rest of that WDW tutorial is guaranteed to give you problems at somepoint.
As mentioned in the comments, you will need to browse to the Settings->General page and update your site URL and wordpress URL.
If you can't get to the Settings page because you get redirected to your local site (this has happened to me before), you may have to edit the values in mysql directly, which isn't too bad, really.
The settings are located in the wp_options table under the option_name "siteurl" and "home". If you need more help with that, post a comment.
You may need to refresh your permalinks: see step 5 below. Official documentation on this subject may clear some things up as well.
Steps to move a local WordPress install to a live site
This is my method, and it has worked every time. Assume local WP install is at http://localhost/wordpress/ with WP database named wordpress and live WP install is at http://livesite.com/ with WP database named livesite:
Create a backup of local WP database -
navigate to http://localhost/phpmyadmin
select database wordpress from side menu
click EXPORT
check the box for Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT statement
click GO - it should download a file called wordpress.sql
Download a database for the live site -
sign in + navigate to http://localhost/wordpress/wp-admin/options-general.php
enter the live site values for WordPress Address (URL) and Site Address (URL)
click SAVE CHANGES - this will break your local WP installation: that's why we made the backup
repeat step 1 [Create a backup of local WP database] - include all substeps
rename this newly downloaded file from wordpress.sql to livesite.sql
Prepare WP files for live site
upload WP file structure to http://livesite.com/
edit /wp-config.php to have live database name, username and password
Import live WP database - if you haven't created the livesite database yet, do so now
navigate to http://livesite.com/phpmyadmin or equivalent
select database livesite from side menu
click IMPORT
choose local file livesite.sql from step 2
click GO - it should successfully import the livesite database
Refresh live site permalinks - your permalinks are set correctly but not updated to reflect the new domain, so get WP to update them
navigate to http://livesite/wp-admin/options-permalink.php
click SAVE CHANGES
it should alert permalink structure updated. If not make a frivolous change to get it to do so, e.g. change permalink structure and then revert
Revert local installation - this can really be done at any point after step 2.
Follow step 4 from http://localhost/phpmyadmin using the backup created in step 1. This is the only way to fix the local install because we changed the domain in step 2 and we can't even get back to the settings page.
NOTES
using WP 3.3.1
using phpMyAdmin 3.4.8
The reason behind this, After you move wordpress site from local server to live you not changed the site url and home address.So, when ever you try to open your site in real server it will redirect back to your local server.You need to open PhpMyAdmin Tool in Cpanel or FTP and select your database then open wp_options table.
In wp_options table change the value of site url and home.
Now your problem will solved.