Migrating the blog server
Enjoying the blog has gone through technical difficulties, I decided to change it from server and update the broken version of WordPress.
The details for the upgrade of WordPress may vary from version to version and can be found on- site .
I could use the options import / export of WordPress itself, but one of the problems with the old provider, was that I was not able to access the administrative area of the blog. Without even making a single upload of anything I could no longer log into the blog and the response I got was the provider:
"... Contact the developers of the WordPress ..."
I then decided to contact a competitor and migrate to the nail ...
The passsos I used were very simple and are as follows:
Hiring the new provider
I did some internet searches, consulted friends, and at the end was just filling out a form, number of credit card and wait for the confirmation of payment.
Backup
While I was waiting for confirmation of the new provider, I was backing up the blog. As I had plenty of "junk" installed, I decided to just back up the database with the posts, and use a version of WordPress limpinha.
To back up the MySQL I used one of its command line tools mysqldump. One of the coolest features (in my opinion) mysql and its tools is the possibility of using them remotely. This has saved my skin a few times in times of SysAdmin.
The command was simple:
=my.old.mysqlserver user @ host: ~ $ mysqldump - host = my.old.mysqlserver - User = myuser - password mybkp.sql - Databases myblogdatabase> mybkp.sql
-Host = my.old.mysqlserver: Connect to the host where is my MySQL database
-User = myuser: Use this user for the connection.
-Password: Ask a password prompt. If I wanted to enter the password directly, could have done-password = mypass.
Myblogdatabase-databases: Make a dump of all tables in the database 'myblogdatabase', used by my blog.
> Mybkp.sql: Redirect the output to a file.
Mysqldump generates all the SQL needed to recreate the database in the same state it was.
Restoring data
At the beginning of file dump has the reference to old database. If the new database has a different name you need to edit the dump file. This can be done with the command sed:
s /` olddatabase `/` newdatabase `/ mybkp.sql > mynewbkp.sql user @ host: ~ $ sed s / olddatabase `` / `` newdatabase / mybkp.sql> mynewbkp.sql
The restoration is very simple, using the mysql prompt:
=my.new.mysqlserver --user =myuser --password user @ host: ~ $ mysql - host = my.new.mysqlserver - user = myuser - password mysql> use newdatabase; mysql>. mynewbkp.sql
This logamos we enter the new base, still empty, and executaamos the file with the dump full of SQL statements to recreate the tables and the data from the old into the new.
Upgrading WordPress
Upgrade WordPress follows the basic steps of installation : download, unpack, move the content to the desired location and edit the file wp-config.php.
Finally, with the browser, execute the file
http://my.blog.root.path/bla/bla/bla/wp-admin/upgrade.php
And voila! You will receive a random password for admin user login and just.
Setting up WordPress
When the provider provides the service, it usually provides two ways for you to access the site's features. One is the standard way to use your domain as address, since the other provides the same capability as a strange url. Today I discovered why this is: while the DNS provider was appointed to the former, I accessed the url in strange new provider without interfering with (mal) functioning of the old site.
After Wordpres installed, any attempt to access the content, redirected to the old blog. Then I remembered that there are two options for configuring the url in the blog. It was enough to know where it was in the database. Following the logic of table names, arrived at the table wp_options.
Using the GUI tool MySQL Query Browser, I changed fields 'option_value' that correspond to the fields 'option_name' option 'siteurl' and 'home' to that url strange, and I have utlizá it during migration, while installing plugins and themes . After all is done, I changed the DNS and finally restored the original values in the options. This command line would look like this:
; mysql> select * from wp_options limit 1; + ----------- + --------- + ------------- + ------------- ------------ + ---------- + blog_id | option_name | option_value | autoload | | Option_id | blog_id | option_name | option_value | autoload | + ----------- + --------- + ------------- + ------------- ------------ + ---------- + | 0 | siteurl | http: // mydomain.com / etc | yes | | 1 | 0 | siteurl | http:// mydomain.com / etc | yes | + ----------- + --------- + ------------- + ------------- ------------ + ---------- + ( 0.00 sec ) 1 row in set (0.00 sec) ; mysql> select * from wp_options where option_value = 'http://mydomain.com/etc'; + ----------- + --------- + ------------- + ------------- ------------ + ---------- + blog_id | option_name | option_value | autoload | | Option_id | blog_id | option_name | option_value | autoload | + ----------- + --------- + ------------- + ------------- ------------ + ---------- + | 0 | siteurl | http: // mydomain.com / etc | yes | | 1 | 0 | siteurl | http:// mydomain.com / etc | yes | | 0 | home | http: // mydomain.com / etc | yes | | 40 | 0 | home | http:// mydomain.com / etc | yes | + ----------- + --------- + ------------- + ------------- ------------ + ---------- + ( 0.00 sec ) 2 rows in set (0.00 sec) option_value = 'http://url.estranha.com/etc' mysql> update wp_options September option_value = 'http://url.estranha.com/etc' where option_value = 'http://mydomain.com/etc'; 0.02 sec ) Query OK, 2 rows affected (0.02 sec) Warnings: 0 Rows matched: 2 Changed: 2 Warnings: 0 mysql>
The first SQL statement was to know which fields of the table, the second to check what the options that had the same url and the third, finally updating. After that, the blog is already pointing to the correct work address, and the return can be made through the site normally.
Conclusion
Migrate a blog on the nail is not the best option, since you risk losing all data. I could only perform this feat, because I know a little of the operation of WordPress and the tools around. Still, I had my moments of suspense. While maintaining home a separate backup of posts, I could not save your comments and options in general. In some ways it was good for me to get smart and go doing my weekly backups of the site.

