Re Uploaded Sql File and Now Wordpress Is Trying to Install Agin
Migrating your WordPress site to another location should be a painless process: you just have to consign your database, import information technology to the new host, move your files in that location, configure everything and make the new site live. However, there are some steps that, when non done right, could provoke several problems that cause problem and lead to unsuccessful site transfers. In this mail service, I review the required steps in a WordPress migration to show y'all the well-nigh common problems I have found after 3 years migrating sites for customers of Migrate To WordPress.
Exporting/Importing your WordPress Database
The showtime step to starting time a migration of your WordPress site is to move the contents from your current host to a new server. To do this, you could utilize the Import/Export native function that WordPress has. However, this may fail or not consign/import all of the contents you have divers, but merely a subset. To avoid this, I e'er recommend tobecome for the database straight, and export a SQL file. But, this may also crusade some trouble.
If you accept access to your database through phpMyAdmin, just try to consign the SQL information post-obit the steps explained in this commodity about squeamish phpMyAdmin tutorial to export your data. Depending on the specific configuration of your server and the size of your database, the process of exporting your contents to a SQL file may fail because of retentivity or timeout errors.
Alternatively, if y'all practice not have access to phpMyAdmin you can try the WordPress plugin Adminer, which provides the aforementioned functionality as phpMyAdmin. Nevertheless, information technology may likewise cause memory and timeout errors when trying to consign your data. But information technology is always worth to try it.
Another possibility yous have is trying to export the information directly through MySQL commands. If yous have SSH access to your servers yous tin can employ the command mysqldump
to exercise this:
Export a SQL file from your database
mysqldump -uUSER -pPASSWORD DBNAME > export.sql
Import a SQL file to your database
mysql –uUSER –pPASSWORD DBNAME < export.sql
Remember to alter USER, Countersign, and DBNAME to the correct values in your installation. If you have forgotten these credentials, open your wp-config.php
file (when yous accept access to it) and yous'll find them there.
If that fails to work, producing a timeout fault, or mysql
and mysqldump
are non available, and then you need to contact the support team of your current hosting provider and request them to create a backup of your database. After that, y'all should ask your new hosting provider to import the previous export file into the new database for you.
Transferring Files, Plugins, and Themes
In one case you have your database ready, it is time to transfer the files stored in your old WordPress host to the new i. Basically, this means copying all the contents from the following folders:
- wp-content/themes: here is where all your WordPress themes are located. Just copy all of thecontents to this folder, unless you decide to switch to a new theme. In that case, you tin can ignore these files.
- wp-content/plugins : here is where all your WordPress plugins are located. Again, copy all thecontents to new new host. Note that the plugin configurations are stored in your WordPress database, so after importing the SQL file from the previous steps, everything should work perfectly in your new host.
- wp-content/uploads: here is where all the media files that announced in the Media Library are located. Notation that the size of this binder may be huge when using a lot of images in your site.
Speed Up File Download/Upload
If you take a very big WordPress installation with a lot of media files, file transfers may accept ages to download from your host and upload into the new one. If that's your example, attempt to do the file transfer in a identify where you take a good internet connection, because you'll probably need it. Fortunately, at that place are some tips that can assistance you lot transferring the media files much faster. Permit me review them:
- Whenever it is possible,make a compressed archive (.nada, .rar, or like) of your media files before transferring them. Information technology's faster (and simpler) to motility 1 big file rather than thousands of small ones. Yet, some hosting providers do not permit this functionality or practice non allow you to have SSH access to your server. If you just take FTP/SFTP access, go to tip 2.
- When transferring multiple files from one host to some other, avoid using FTP/SFTP directly. Try parallelizing download/upload connections by using LFTP and mirror commands.
- If you have SSH admission to both servers (the old and the new one), transfer your files (or compressed archive file) directly from your old hosting provider to the new server, instead of downloading them locally into your computer and then uploading them from at that place.
Regarding LFTP, here are the commands that you should use to download and upload the previous folders recursively and with parallel connections, reducing the terminal amount of time required for the transfer:
Download files to your computer
lftp -c "open up ftp://$username:$password@$ftp_hostname;lcd /path/to/local/directory/in/your/calculator;cd /path/to/remote/directory/in/ftp/server;mirror --parallel=20 --but-missing;"
Upload files to new host
lftp -c "open ftp://$username:$password@$ftp_hostname;lcd /path/to/local/directory/in/your/computer;cd /path/to/remote/directory/in/ftp/server;mirror --reverse --parallel=twenty --merely-missing;"
Problems with File Permissions
When you transfer files from 1 host to another, their permissions are moved too. Some hosts allow y'all to have files with permissions like 777, which in UNIX means that everyone tin take full access to the file (read, write, and execute it). Such file permissions present a huge security take chances, and if you are switching to a host that cares virtually security and forbids this, transferring files may upshot in an "Internal Server Error" folio.
Having SSH access to your server, you lot can change the permissions of the files through the following command:
chmod -R 644 /path/to/folder/
It is also possible that your new hosting provider allows yous to change permissions of your files through an option in their Administration Panel, like WPEngine does:
Fix Thumbnail Sizes
The moment doing a WordPress migration is the perfect time to redesign your theme or directly switch to a new one. If that'due south your case, take a await at your featured images, because it could happen that all the new images that are uploaded after activating the new theme expect good, butthe sometime thumbnails appear ugly and distorted. And just trying to adjust epitome sizes in Settings -> Media, won't solve the problem.
It is of import to note that when you upload an epitome to WordPress, information technology creates duplicated images of the original one (called thumbnails) of dissimilar sizes and saves them in the uploads folder. What sizes? WordPress gets the image sizes for thumbnails from your theme. Your theme defines the thumbnail sizes, which are really useful to load the best paradigm size when needed. There is no need to load huge images when displaying a listing of posts. In these cases, your theme displays smaller thumbnails. Adapting the thumbnail size to each state of affairs improves the final loading time of your WordPress.
Nevertheless, as we have already mentioned, the trouble is that these new image sizes are only applied to the images that y'all upload after activating the new theme. To solve this problem yous demand to generate new sizes for all the previously uploaded images. This process is oft referred to equally regenerating thumbnails and, as always, there is a plugin to do that.
In gild to practise this, you merely have to install the plugin Regenerate Thumbnails in your WordPress installation. Then, activate the plugin and go to Tools -> Regen. Thumbnails. Press the button Regenerate All Thumbnails to start regenerating the thumbnails for all paradigm uploads. You can likewise regenerate the thumbnails for private image uploads or specific multiple image uploads in Media -> Library.
Annotation that this plugin does not delete previously created thumbnails past old themes. This is something you should do manually if you are sure that you haven't used those sizes anywhere on your website. Look for images inside your wp-content/uploads
binder in WordPress that have old unused dimensions. Be conscientious when deleting them; it volition costless space in your hosting disk, but it tin too have side-effects on your site when deleting wrong images (images that you actually use).
Regenerating thumbnails is very handy if you've changed any of your thumbnail dimensions (via Settings -> Media) after previously uploading images, or take switched to a theme with different featured image dimensions.
WordPress Configuration after Migration
This office can be tricky too. Your database has lots of references to your old site. If you lot changed your domain proper name in a migration, trying to access to your new WordPress site afterward importing your database file will result in several redirection problems. The reason for this is that your WordPress thinks that it is located in your old server with your old domain. To solve these wrong URL address problems, continue reading.
Telling WordPress that the Site'due south Location Has Changed
WordPress stores your site location on the wp_options
table. You can run into it when you go to to Settings -> Full general:
If the URL you see there is not the URL of the new domain,WordPress will e'er redirect you to the URL you have there. In order to easily fix this issue, search for the post-obit lines in your wp-config.php
file (or add them to the end of that file) and put there your correct URL:
ascertain('WP_HOME', 'http://my-domain.com'); ascertain('WP_SITEURL', 'http://my-domain.com');
These two statements tell WordPress to ignore the values in the database and use the home and site URL values that you specify in the wp-config.php
file.
Updating URLs in Posts and Custom Fields
When you change the domain proper noun, you need to update all the posts and custom fields that include the old URL with the URL of the new domain. When y'all insert a link or an paradigm, WordPress will store information technology with its total path. All these absolute references have to exist replaced when yous're moving to the new domain. Otherwise, all inline link and images still point to the previous domain, producing 404 errors.
To fix this, we can directly go to phpMyAdmin and access our WordPress database. Before doing anything, y'all should fill-in the database, using the export function we described before. Afterwards, yous can apply the post-obit SQL statements:
UPDATE wp_options SET option_value = REPLACE(option_value, 'http://my-one-time-domain.com', 'http://new-domain.com') WHERE option_value Not LIKE '%{%'; UPDATE wp_postmeta Set meta_value = Supercede(meta_value, 'http://my-old-domain.com', 'http://new-domain.com') WHERE meta_value NOT LIKE '%{%'; UPDATE wp_posts SET guid = Supplant(guid, 'http://my-old-domain.com', 'http://new-domain.com');
Once you lot have run each of these update statements, phpMyAdmin will tell y'all how many rows in your database were updated. Check that this number makes sense.
Note that I've excluded rows that have the character { in them as they would exist part of serialized arrays. To replace URLs (or any other string) inside serialized arrays, become to the adjacent section
Fixing Serialized Arrays in PHP
Serialization has become a standard in many programming languages. The problem with serialization is data portability. Let'due south see an instance of serialized information in PHP:
a:2:{i:0;s:67:"http://my-quondam-domain.com/wp-content/themes/twentythirteen/style.css";i:ane;southward:0:"";}
As you tin see, the data is organized in a manner that it has information types and number of elements in every data type. Concretely, at that place is a String URL that contains 67 characters. And that'south the trouble.
If you change your domain, replacing information technology is not enough. If the old and new domain don't have the same number of characters, and you search and replace the domain URLs in your database, you could go far problem and decadent your content information.
There'southward no way to update serialized arrays using merely MySQL queries. You need to use PHP, load the arrays, find the values, supervene upon them and serialize back. That's very tedious and error decumbent, just there are several tools that help you doing the difficult chore. My recommendation is to use a plugin that does the complete migration for you lot. WP Drift DB, Duplicator, or All-in-One WP Migration are some examples of skilful plugins for this chore, and they have care of replacing the serialized arrays.
Alternatively, you tin use this WordPress search and supercede database tool. Information technology carries out database wide search/supercede actions that don't impairment PHP serialized strings or objects with a user friendly interface.
Change DNS to Betoken Target Site
Once yous take the new WordPress installation ready to be live, the final step of migrating your website is the DNS change. This is something that only experienced people should do, because it may cause your site to go downward. And you don't want that!
Sometimes, it is better to contact the support team of both your old and new hosting providers. They volition aid you lot and provide the correct instructions to follow when performing the DNS alter. Note that domain records changes need a propagation period to have place. This time is required because all of the world's DNS servers need to update their records about your domain name.
In addition to it, while waiting for the DNS propagation period to laissez passer, you can disable the comments and login on your erstwhile hosting. This mode, you avert losing new comments or other user activity during the so-called propagation menstruum. When doing the DNS change, be careful with your e-mail configurations. It may be the example that when irresolute some records in the DNS configuration, you destroy your mail service records. Once again, and sorry to repeat this, contact a professional to perform this alter and ensure that you won't lose annihilation.
If you liked this article, let me know by sharing information technology through your social networks or by writing a comment. And if something is missing, we can work together to include it on the list 😉
Featured image by Benson Kua
Source: https://neliosoftware.com/blog/wordpress-migration-problems-and-how-to-fix-them/
0 Response to "Re Uploaded Sql File and Now Wordpress Is Trying to Install Agin"
Post a Comment