I'm trying to replace the WordPress database I have on my live server. Here's the scenario: I have two databases on my server. The old one and the new one. When I edit config.php to change the database name from the old one to the new one, WordPress wants me to re-install. Here's why I'm confused...
The tables in the new database have been updated to the old URL (I'm keeping the same URL).
It's the same database user so the db user and db password don't need to change.
The db user has permissions for the new database.
I thought that I should be able to change the database name and go, but WordPress isn't letting me. Any help would be greatly appreciated. I've been working on this for several hours and I'm at my wit's end. I know there just HAS to be a way that doesn't involve manually adding/editing content in the WordPress admin.
Have you made sure that the wp-config.php:
$table_prefix = '';
Is the same as the prefix in the database (phpMyAdmin) if you use that? Usually that can keep displaying the admin/install.php page.
Wordpress prompts you to reinstall Wordpress because you're missing a whole directory in your Wordpress files (forget which one, sorry). In part, it will create the wp-config file which will store the database info.
I can't see it be bad to follow the install process, it'll ask you for the credentials to your database, which should atleast overwrite the old file and configuration. Don't forget to backup your files before doing this, in case it all goes to hell.
I had the same issue. It turned out that my new MySQL DB had an issue.
I restored the DB with innobackupex and didn't apply the --apply-log parameter on the backup directory to create the correct log files for the InnoDB engine.
Check your MySQL error log file to make sure that everything is normal. The log file's location is /var/log/mysql/[hostname].err.
Related
How can i update old backup data of my website to new server. which tools should i used to upload backup or is there manual to do it?
Many way to move old backup to new server but i prefer All in one migration plugin.
https://wordpress.org/plugins/all-in-one-wp-migration/
Firstly, please do more research before asking a question. This question has been asked probably over a million times before.
Official guide: https://wordpress.org/support/article/moving-wordpress/
Guide: https://wpengine.com/resources/migrate-wordpress-site/
Guide: https://www.wpexplorer.com/migrating-wordpress-website/
Guide: https://www.wpbeginner.com/wp-tutorials/how-to-move-wordpress-to-a-new-host-or-server-with-no-downtime/
I can list the links forever...
Here is how I would do it:
Log in to FTP and download the root folder with all website files (the folder is usually called html or htdocs).
Login to phpMyAdmin (if you don't have phpMyAdmin you can use MySQLWorkbench) and export the database.
2.1. If there are multiple databases, you will have to check wp-config.php define( 'DB_NAME', 'DATABASE_NAME' );.
Now do the same with new hosting just in reverse.
Log in to FTP and upload your website files to root directory.
Log in to phpMyAdmin and create a new database and then import the exported database. Make sure to create a user with correct permissions for that database.
(optional: if your domain changes as well make sure to change it in wp_options table)
Edit wp-config.php - enter new details for the db name, db user and user password.
DONE
You can also use a plugin for that but most of these type of plugins are paid or have limits on how much you can export etc.
I wanted an exact replica of my current wordpress website on a different domain with a different database.
So I created a database in same db host as the original database.I changed siteurl and homeurl in new database to the corresponding new domain.
I dumped the same code to new IP and changed wp_config file i.e. dbname,dbuser and wp_home wp_siteurl.
I kept db_host same as I have both the databases on same host.
I was able to get the replica up on new domain,but I am facing following issue -
whenever I change my password for admin in new admin panel , it gets reflected in my original website database and vice a versa.
Similar thing is happening for advanced custom fields in my admin panels.If I change something in new admin panel,it is reflected on my original website.
What could be the issue?? I think I have followed all the guidelines of wordpress migration to other domain.
Thanks in advance :)
You need to change the domain name in database then only it will solve the redirection issue.
If you have updated database details in wp-config.php file, there is no chance for the issue. First please confirm that both wp-config.php files have different database details like database name, user name & password.
For WordPress database migration between different domains, either use wp-cli command, or some other database migration plugin. An updating wp_home & wp_siteurl in DB is not enough.
https://developer.wordpress.org/cli/commands/search-replace/
https://wordpress.org/plugins/wp-migrate-db/
My website keeps going Website keeps going to http://MyWebsite.com/wp-admin/setup-config.php. Can you help? Thank you
If WordPress can't find the tables in the database, it will be redirected to the setup process. This usually occur when you transfer the website to another host and the prefix is different. Check your wp-config.php for the table prefix to see if it matches what's on the database.
.htaccess doesn't have anything to do with this. If your site was running before and you're suddenly gettting the Install screen, your database details in wp-config.php have changed, such as the database name and/or table prefix. Check those. You are connecting to the database, as you're not getting a database error. But your table prefix or database name was changed.
I'm in the process of trying to move a WordPress site from "example.com/wordpress" to "newsite.com" and I've run into some considerable trouble.
I made a backup of the database and put a copy of all of the WP files onto the new host. I then tried to change the URL, but got a bunch of errors on the new page. I tried to revert back to the old site in the hopes getting everything in order again, but now everything redirects to the "new" site. My wp-config and database settings are all the same as they once were since I never deleted them off the old site. I've since deleted the files from the new site. The page is still redirecting and I can't access the dashboard login.
I'm completely at a loss right now, so I could really use some expert opinion. Thanks for any help that leads to a solution.
Old Site Link
If you have access to phpmyadmin or any interface for your database you can go into the wp_options table and update rows 1 and 36. As jogesh_pi mentioned, the base url of your site is stored there, so you will need to update the database with your new path.
You can run this query in phpmyadmin and it will do it for you. Obviously replace the newsite url with your own.
UPDATE wp_options SET option_value = 'http://www.newsite.com' WHERE option_name = 'siteurl' OR option_name = 'home'
You need to run a database query that updates all instances of your old URL with your new URL. The process is explained in detail in the Wordpress Codex.
I like to use this very useful PHP script for running the database update automatically as it takes into account serialized strings which in certain cases can break widgets or plugins if they are not addressed.
I always run into this issue, I use this plugin now to transfer wordpress sites: http://wordpress.org/plugins/duplicator/
But heres a quick fix:
Login to phpmyadmin, go to your database
Go to wp_options
Change these two options to your new url where my url's are the old ones:
If your wp-content folder is of the old site contents, it should pick up. But if your images dont show, use a URL changer plugin like this one: http://wordpress.org/plugins/velvet-blues-update-urls/
it's just a simple query that helps you to transfer your wordpress site from old to new.
update wp_options set
`option_value` = replace(`option_value`, 'example.com/wordpress', 'newsite.com');
beside this make sure about the file permissions and the database is same that you have used in the old site.
I have a client's wordpress site that is built using Wordpress and Headway. I need to move it to a new domain on a new shared server ( same host provider with the same hardware configuration ).
I've moved many wordpress setups like this before, including Wordpress / Headway combos. I've also, during debug, used Headway's documentation and videos to double check that I'm doing everything correctly.
I moved the database over and replaced all occurrences of the old domain with the new domain, and updated all filepaths. Then I copied the public_html folder to the new server. The site should be working at this point.
Instead I get the Headway error message No Content to Display on an otherwise empty html page. I've traced the problem to the wp-config table where Headway stores serialized data for it's blocks. I can update data throughout the database to the new domain everywhere except in these Headway entries in the wp-config table. As soon as I update those, the site starts to fall apart all over the place, and if I update them all, the site loads the Headway error message No Content to Display. The underlying Wordpress system seems to still be working as I can load the /wp-admin console and all my content exists and looks correct.
If I trace the problem deeper, it appears that the Wordpress function get_options() is failing in the Headway file data-layout-options.php. I have been unable to debug any further.
The site works perfectly on the original domain, and, in theory, I'm doing a direct copy of all data and then simply replacing the old domain with the new domain.
Can anyone help with a similar problem? It feels like I'm chasing a bug in the code when really it's some sort of simple oversight or config setting that has been munged. Please help!!!
I was indeed close to the problem.
The serialized Headway data in the Wordpress wp-config table contains string lengths. Migrating the database oneself, and then grepping and replacing the old domain with the new domain and old web folder file path with the new web folder file path causes unserialization to fail in the Wordpress system ( eg. the get_options() Wordpress function ).
Instead of writing a custom script to deal with the string lengths, I tested a few database migration plugins. WP Migrate DB was the winner and solved the problem.
Migrating the Database
Install the plugin on the original domain ( original Wordpress install ). It will ask you to input the new domain and the new file path of your web directory ( the web directory file path is very important as well ). In my case, for example, the file path of the web directory had changed from /home2/old_username to /home6/new_username.
The plugin will then dump the entire Wordpress Database and replace all occurances of the old domain and old file path with the new domain and file path of the web directory. The .sql dump will then save locally on your computer.
This was not perfect however, and I still needed to do a few of my own grep and replaces. Additionally, I had to be careful about this because a few of the ones that were missed were in the Headway serialized data and I had to do MySQL queries to make sure I updated the string length properly.
These few updates were missed because some of the database entries had http://www.olddomain.com and some had http://olddomain.com. The plugin did not catch it all, but made it manageable to replace by hand.
Finally, I had to import this updated .sql dump into an empty Wordpress database on the new domain.
Moral of the story is that Headway V3 is not simple to migrate to a new domain. You must be very meticulous.
Another option, that I did not try because it costs >$75 was BackupBuddy. It's likely that BackupBuddy will still miss some domain and file path updates, so be careful.
I have found the solution of T. Brian Jones and have just applied it for WordPress 3.8.1 with HEADWAY 3.6.2.
All works fine.
One trick for newbes like me: if you don't know the file path on the server where you are moving your database, before you do database dump install WP Migrate DB on this server, run the plugin (Tools) and get the path from there...
Thank's TBJ
Maciej