I'm currently moving sites from one server to another. In doing this, I'm setting up new dev environment to help test any issues we may have in moving the site.
I've already moved one site, quashing all issues. I've had some issues with the latest two sites.
My work flow normally is:
1) Export
2) Edit to dev URL in Sublime Text via find/replace
3) Import to DB
Importing a MySQL dump first gave me an error such as
"ERROR at line XXX: unknown command YYY"
In one such scenario, this seems to be caused by an encoding issue (STX) for some unknown character.
I can get such errors to go away by using MySQL flags such as:
-default-character-set=latin1 for the mysqldump and NOT using --default-character-set=utf8 with the import.
This gets me further in the process, as things seem to be working, except no images show in Media (just default.png) for the thumbs. I've verified that the files exist on the server and checked permissions. When clicking on an image in Media, I can copy/paste the URL and the image shows properly in a browser.
Another example of where the data isn't fully transferring is that the template used for a page isn't being retained.
I'm at a loss at this point on how to properly export/format/import the MySQL dump. I've even tried the WordPress repair database utility without any change in results.
O. Jones comment mentions a plugin called Duplicator. I didn't utilize this given our situation so I cannot speak to whether or not it would. If that would work correctly, I would imagine that the ideal solution for most.
The solution that I've utilized is simple but may not work for those without access to or unfamiliar with MySQL.
The steps are:
Export via "mysqldump -u {user} -p {databaseName} >
{filename.sql}
Import like usual (without issues)
Log into the new MySQL database where the import was completed, use that database and run the following queries:
UPDATE wp_options SET option_value = replace(option_value, '{oldURL}', '{newURL}');
UPDATE wp_posts SET guid = replace(guid, '{oldURL}', '{newURL}');
UPDATE wp_posts SET post_content = replace(post_content, '{oldURL}', '{newURL}');
UPDATE wp_postmeta SET meta_value = replace(meta_value, '{oldURL}', '{newURL}');
These four queries may need to be run for each variation of "http://oldwebsite.com", "http://www.oldwebsite.com", "https://oldwebsite.com", and "https://www.oldwebsite.com".
Related
I'm using Wordpress 4.6.1 with the theme Goodlife.
Whenever I change the domain, my theme loses all settings (theme options).
Analyzing database, I realized that he loses the values changed in "option_tree" option.
To change domain, I use these queries:
UPDATE wp_posts SET guid = REPLACE(guid,'old_url','new_url');
UPDATE wp_posts SET post_content = REPLACE(post_content,'old_url','new_url');
UPDATE wp_options SET option_value = REPLACE(option_value,'old_url','new_url');
I made a simple test to confirm, and copied the value of this option and enter directly into the database. Just that I load the wordpress that the value is lost again.
Now I have the "option_tree" value in a txt file, but the wrong value in the database, how can I use the real value in my website without it being overwritten?
Without seeing exactly how the data is structured, I'd bet 100% that the theme option corruption is due to the search and replace screwing up serialized data. Since serialized data defines the exact length of it's data, a search and replace (unless the before and after terms are exactly the same) can have the effect of corrupting all the data in the field. Most theme options are saved as serialized data.
Instead of trying to run your custom commands, I've found a LOT of success with this search and replace script meant for this exact purpose:
https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
Follow the install instructions and run the search and replace through their tool. It correctly handles serialized data and prevents errors from occurring in the data.
I have many posts in wordpress. In that post I have links like dev.dev.example.com now I want it to replace with dev.example.com.
I am using following query
UPDATE `dbname`.`wp_posts` SET `post_content`= replace(cast(post_content as varchar(max)), '%dev.dev.example.com%', '') WHERE CONVERT(`post_content` USING utf8) LIKE '%dev.example.com%'
I think it is better to follow wordpress' official guide when moving a wordpress website. http://codex.wordpress.org/Moving_WordPress
Alternatively, as an easy way in your case if you have already done all other steps but stuck in this issue, you can export database to sql file, open in text editor like notepad, use find-and-replace to replace all x.com to y.tom and then import the database. But remember that if domain length is different, you will have some settings lost. It is because wordpress keeps serialized data where length is stored.
Using your way to do via query is not a robust way because some other tables may still have old domain name.
I have been running a website from home for a few months now and suddenly phpmyadmin is not showing me all the tables in the mysql database.
Here is a screenshot 1:
I thought the database could be corrupt or maybe someone has executed some bad sql code so I deleted the database and tried to restore from a date that I knew was working and the same thing happened. So I built a new server thinking something in phpmyadmin could be corrupt but now I am facing the same issue on the new server.
I tried manually creating the database but after so many tables have been created the same thing happens.
As you can see in the screenshot 1 on the left side it stops after customcars but then in the middle in continues to downloads. There should be more tables but they will not show up.
I have ran a script to check if they exist and they do but I just cannot access them on phpmyadmin
I have tried importing the database with a .sql file and still no luck.
Sometimes it evan looks like this
Notice the way the customcars on the left is missing and so is the X in the middle for downloads.
My Operating System Is Centos 6,
Mysql Version 5.1.73,
Phpmyadmin 2.11.11.3
Thank you for reading and I hope someone out there has had the same issue so I can fix this asap :)
You might want to check that Settings > Navigation Panel > Maximum items in branch is not set to a low number. http://docs.phpmyadmin.net/en/latest/config.html#cfg_MaxNavigationItems
I had the same issue. I found an eye symbol next to my database name in the left column. When I cliked on the eye symbol I had the option to unhide the missing table. I have no idea how I managed to hide this table but this solved my problem.
You might accidentally hide any table by clicking eye on PhpMyadmin. Click the eye icon then it appears a pop up to show the hidden table.
I was given an sql database that I was supposed to do some stuff on, and I want to clean it up, given that they have stuff with "special characters" as values, such as carcaças. Notice the `ç.
My Update command just simply doesn't want to work. I've checked in a million times and the weird part is on the webservice that I'm creating using that database the line seems to do nothing, but when I go on phpmyadmin it works perfectly. It has nothing to do with permissions given that its all being hosted on my computer.
So here you go the code:
function filter($stockconn){
mysqli_query($stockconn,"UPDATE produtos SET familiaprod='Carcacas' WHERE familiaprod='Carcaças'") or die(mysql_error());
mysqli_close($stockconn);
}
So far its all very simple, simple connection file (which is working correctly 100%) being pulled towards that function.
Seems phpmyadmin trims the end of the sql output when running operation commands ..
I really need phpmyadmin to show the full output
Any Ideas?
After a quick search on Google i found this: http://wiki.phpmyadmin.net/pma/Config#MaxCharactersInDisplayedSQL
It seems that you just have to edit the config file of PHPmyadmin and set $cfg['MaxCharactersInDisplayedSQL'] = 1000; to the value you want.
My problem was even more simple. I was using "show create table", but the result was truncated after a handful of chars.
PHPMyAdmin actually has a small "+options" link over the results, with simple options like "truncate results". Just needed to untick that !
If you want to edit the files mentionned by Torr, look for :
config.default.php, in 'librairies" folder, which contains existing parameters
config.inc.php, where you should copy/paste the ones you need to.