Wordpress Resetting wp_options Rows - mysql

I'm attempting to import a SQL dump into the wp_options table. After the import, and before attempting to load the site, the values are appearing correctly in PhpMyAdmin. However, certain option values are reset as soon as the site is loaded by navigating to the domain in a browser. I'm wondering if there is some sort of fallback built into wordpress to reset corrupt values? Does anybody know about anything along those lines in wordpress?

Related

phpMyAdmin seems the easiest way to populate my new vBulletin forum with hundreds of new users and articles. How do I do it?

My new vBulletin forum is empty, and I want to encourage new users to visit, like and contribute. But first, I need to make it...not empty. As an admin, I could manually type in a bunch of threads, all from 'admin' - but that won't work. One look at either an empty website or a site filled with admin posts are equally undesirable. So I need to add hundreds of posts from hundreds of users before day one.
I assume that I should do this via the database, which I can access from phpMyAdmin via cPanel. I tried to download (export) the 'user' table with its 74 columns as a CSV table for MS Excel, but when I opened it in Excel, it was not in table form - it was all , and " in a string. If I could only see it laid out nicely in Excel, I could paste hundreds of usernames into the USER table, and and hundreds of articles into the THREAD table. I think. Am I missing something?
I am definitely going to fake it until I make it - there is simply no other way with a new website. The question is whether I have to manually do it from the front end for each user and each new thread (weeks of work), or whether I can paste them all into the database in a couple of hours.
Please help. Thanks.
Just regarding Excel, use the 'Text to Columns' tool on the Data tab to convert the CSV string into columns.
Where are you getting the content from to pre-load your forum though? If you have to make it up anyway, then is there much actual time saving in loading data in via phpMyAdmin in reality?
Assuming you have some content available from somewhere though, then you can export to CSV again from Excel and use a CSV to SQL tool (eg. https://codebeautify.org/csv-to-sql-converter though there are others around also) to generate SQL INSERT statements for uploading via phpMyAdmin or other DB tools. (I don't recall if phpMyAdmin has a SQL file upload mechanism or if you just have to paste the SQL into the browser window... have not used it for a good few years now).

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

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

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).

Exporting Database Using phpMyAdmin

I'm attempting to switch from Third-Party Hosting to In House hosting. I have all sites but one transferred. The last one I'm having issues with involves some plugins. I'm asking the plugin programmer for a new download, and was told that I have to export the database.
My question is: is there a way to export every concept of the database including Column Headers. I'm wanting to export the whole database, so when I import it into my SQL Server I don't have to do anything, just go into WordPress import the setups for it.
If you already have access to your current database phpMyAdmin
Log in to it
Select the desired database from the left menu
You should see an Export tab in the right panel, click it
In Export Method you can leave it as Quick
Export it as SQL
Press GO (the submit button)
If you happen to have any problem downloading the export, try using the custom method and selecting one compression (gzipped for example) method.
Then, importing the database is the inverse process into your new Database.
Login to your new database phpMyAdmin
Select your newly created DB
Click Import tab
Select the file to upload
Go
Make sure your new database is EMPTY if you want to migrate ALL THE TABLES. If you want to just migrate a few tables, you can select them in the custom method and then import only those.
Make sure you are running the same Wordpress files with your DB data, or you may experience many inconsistencies.
The primary issue was fixed with a new download of the plugin.

Want to restore data to contact form 7, wordpress

My site got hacked and in the end I had to remove the entire WordPress installation and database. My biggest problem now is that I used the Contact Form 7 with a very large number of contacts and it is no longer in my database since I had to make a new one. I did manage to make a backup of the tables containing the contact form data (as SQL and XML). But I don't know if it's possible to restore the data from the backed up tables to the new ones? I don't want to drop the new tables and replace them with the backed up ones (and alter the names of the tables), because I'm not sure if the constraints get the correct name and so on. The database is MySQL via phpMyAdmin
So, essentially I want to move data from one table to a new! Is it possible?
EDIT: Så I imported the old contact form tables, with new names, and it didn't work. BUT, when I reverted to an older version of contact form, it worked. Seems there is a difference in how the versions handle and stores the data. But now I can't upgrade it! As soon as I do, all my contacts disappear. Does anyone know how to fix it, or why it behaves this way?
Contact Form 7 holds all its data in wp_contact_form_7 table (assuming your table prefix is wp_) and doesn't assign forms to pages with a typical database key relationship. Rather, it will place a marker in your page content that gets interpreted and replaced by the plugin and renders the proper form based on the name it finds in your post.
Assuming all your pages & posts have been imported back into your new DB the way it was before, and you've already got CF7 enabled as a plugin, you should be able to import the old contact_form_7 table into your new database from phpMyAdmin without issue.
As always, make a backup of your new database as well in case something goes wrong.