Migrating From a Combined Hand Crafted Website and WordPress to Only WordPress - mysql

I've migrated a hand crafted website to WordPress website. The previous implementation did have WordPress in a sub directory for a blog. Apparently the admin for the blog was not the owner of the website, I couldn't get the admin username and password from the owner so I couldn't use the duplicator plugin. Due to time constriction I was not able to merge the blog into the new website prior to removing the active blog.
I have all the files and the database (in database.sql form) from the previous version of the website.
I have found the database table diagram at Codex, but I'm most interested in the minimal number of tables necessary to transfer.
What tables from the old database do I need to import into the new database (after changing all the absolute links to the correct addresses)?
I know about the wp_postmeta table and wp_posts table, are there any others I need to import.

It depends on what data you want to preserve.
The main data types and tables are:
Terms (wp_term_relationships, wp_term_taxonomy, wp_termmeta, wp_terms)
Comments (wp_comments, wp_commentmeta)
Users (wp_users, wp_usermeta)
Do you not want to just import the whole .sql file and start from there? That might be easier than trying to piece things together. You could then drop any table than doesn't being with wp_ (or whatever prefix you used).

Related

How do I merge two Wordpress SQL databases in phpmyadmin?

I do not want to manually type in thousands of posts from my old website on the front end of my new website. I simply want to merge the database from the old into the new website in phpmyadmin. I'll tweak the tables to suit the new software afterwards.
I think there are only four tables that need to be merged for my purposes: wp_postmeta, wp_posts, wp_usermeta and wp_users.
The old website is still live, and the most recent post is post_id 28,556. So to be safe and neat, I want all my new website post ids to begin at 30,000.
I found this code which is sort of what I'm looking for, but not really: https://gist.github.com/jazzsequence/99dbee218c1b9a84df0d. This code simply adds +1 to every row, ignoring all associations with usermeta, users, post_ids inside postmeta etc. It cannot be used.
If you are unable to answer the question in it's entirety (it will help thousands of wordpress users if you do it properly), please tell me how to add 30,000 to every value in a given column. eg. If the column is called ID and the existing values are 1,2,4,9,13,24,25,26,28, then they would become 30001,30002,30004,30009,30013,30024,30025,30026,30028.
This might only partially answer the question as it might not allow you to do it manually, but actually I wouldn't recommend it.
People already worked on this export - import logic, tested it and wrote plugins for that. I would suggest to use them instead of trying to write it all over again yourself.
Just backup your databases and use plugins such as: https://wordpress.org/plugins/wp-exporter/
I would do a google search and find the best export / import plugin that does exactly what you want, there are many of them out there for free.
For the last part of your question, I think
UPDATE `table` SET `ID` = 30000+`ID`
should be enough.
So if you want to combine two MySQL databases in WordPress quickly and easily, then you should read my blog post: 8 Simple Steps to Merge Two WordPress MYSQL Databases
Here, we will stumble upon the eight simple steps that will help you merge two MySQL WordPress databases in a matter of few minutes.
Let’s begin the PROCESS:
Step 1: Create Two New WordPress Installs in a Sub-folder.
In case your old site is not hosted, then you need to get it setup and running either in a subfolder on your server or locally on your PC using MAMP. Also, set up two new installs of WordPress for two different purposes:
To host the old WP database that you want to import, and
To create an exact copy of your existing WP site.
Step 2: Log into the database of your old WP site
oldIf you want to log into your old site’s database, you need to emulate the following process:
Go to wp_users in phpMy Admin.
Change the password (if you know which account was the site’s admin)
Click Edit next to their name and enter the new password in the user_pass field.
Select the MD5 from the drop-down menu to the left.
And hit the Go button to get the things done.
Step 3: Install WordPress Export tool
exportInstalling the WordPress export tool is as simple as clicking a button. All you need to do is to go to the Tools, click on the “Export” button, and install WP’ export tool.
Step 4: Select data and download export file
downloadThis step is all about selecting certain data/sections that you want to export. It may include multiple files. Once selecting the desired files, you’ll need to click on Download Export File button.
Step 5: Log into your copy of current WordPress site
Under this step, you need to log into your copy of your current WordPress website.
Step 6: Install the WordPress Import tool
To install WordPress Import tool, you first need to go to the tools in your settings option and click on the Import option.
Step 7: Select “WordPress”
Step 8: Select the created data file and import it
If everything combines perfectly into the test copy of your WordPress site, you can freely import the data into your actual site.
There is a new plugin : Versionpress (https://versionpress.com/open-source/).
You should manually install this plugin in your two wordpress websites. this plugin create a .ini files and it can merge your 2 databases

MySQL data transfer/update to another database

I have a forum which is here or http://neue.st/index.php
and I want to transfer the data from that forum to a new forum in a different directory http://neue.st/forums
I also only want to have select pieces of data to be transfered such as users, posts, topics, forums but not things like themes & mods
I am doing this because I kinda of screwed up the data for mods & themes for the original forum & have no idea how to reverse it because I forgot to do the backuping
Is there anyway to do this with phpmyadmin
A good tool to use... but not absolutely necessary is PMA (phpMyAdmin). You should log in, click on the database you want to export data from and then click the export button.
You can see there is a "custom" choice, upon selecting that you will be presented with more options including the ability to choose which tables you need to export.
After that, head on over to your other database and import the SQL file that was generated/downloaded and happy days.
you can use SQLYog community edition, it is easy to select what ever data you want to export.
If you download the Support toolkit from phpBB you are able to 'clean' the database of all non standard tables and rows (i.e. things added by MODs), leaving you with a clean database.
For themes that you no longer need, you can delete and uninstall these via your Admin control panel before removing them from your server.
If you just use 'selected' parts of your database then chances are it won't work properly because there are so many relationships between the different tables.

Uploading large amounts of data via a csv into mysql Wordpress database?

I have a large data set in Excel that I want to import into my mysql database for Wordpress.
The current data in Wordpress is made up of two important parts - the users and the posts (with custom data). Each is registered on the site (via the front end) and has to fill in some custom data about their company - that then creates a post and puts all the custom data into the custom fields.
I've used the plugin Advanced Custom Fields to input the custom fields on a post.
How can I upload this list straight into the mysql database? It seems that the current data in Wordpress involves linking the user mysql table with the usermeta table and the posts with the post meta table... but all this seems to be in rows rather than columns, which would take a huge amount of work to reorder.
Isn't there an easier way?
If I have to do it in 3 stages then (1. the users. 2. the posts. 3. the post meta), then I'll have to do it that way. But surely there's a quicker more reliable solution!
There are a few plugins that can do this for you, such as these:
http://wordpress.org/extend/plugins/csv-importer/
http://wordpress.org/extend/plugins/wp-ultimate-csv-importer/
You'll need to set up a blank copy of WordPress, install the plugin, and go from there.

Can a separate WordPress (same server) get posts from an existing one, but have different settings?

When developing WordPress themes for a site with a large amount of posts, how can I dynamically pull existing post data from the live version of the site onto my testing site? I already know about WordPress's export feature, but that's one-and-done, not dynamically queried.
Plan A:
Proposed Solution:
Create read-only user in live site's database
PRECAUTION: change test site's prefix from "wp_" to "test_"
Problems:
Settings (like current theme) on test site cannot be changed, thanks to read-only user
No posts found in "test_posts", even though I'd like it to search "wp_posts"
Is there an easier way or existing solution to avoid rewriting WordPress system files on the test site? I'd really rather not rewrite WordPress's database interface...
Similar: Linking themes across WP installations
just duplicate the DB, re-name and call DB in wp-config!

moving wordpress mu to another domain - sql statements

I'm assuming these instructions are for "normal" wordpress... will this work with wpmu or do i need to modify this? Is there anything i should watch for?
http://www.mydigitallife.info/2007/10/01/how-to-move-wordpress-blog-to-new-domain-or-location/
See Moving WordPress « WordPress Codex and WordPress Serialized PHP Search Replace Tool
The biggest issue you face is changing URLs in the database; and you will need to change these URLs in each of the individual databases that Multisite installs uses. Check out the find/replace tool linked above; it correctly deserializes/serializes data in the database. If you change URLs in a text database dump, or with SQL queries as in the link you listed in your question, you risk breaking data, such as theme options and widget settings.
1/09/2016 Note: WordPress MU doesn't exist anymore. MU was rolled into WordPress core in version 3.0.