Oscar’s blog is back!

oscargt Avatar

My blog has been down for a while, mainly because my hosting company did some crazy refactoring of their system which left this blog in the dark. After trying to figure out how to get it back up, for around 30 minutes, I gave up. I did not get back to it (was super busy) till now; a year and a half later!

To get the blog up and running, I had to re-download wordpress, install a fresh copy, the I had to manually copy my posts from the old defunct database to the new database. So I used some good ‘ol SQL to get that done. To move all my posts from one table (eg. wp_posts) of my old wordpress to a new table (eg. wp_new_posts) all I dis is go to the SQL section on phpMyAdmin and then type in this code:

INSERT INTO
  wp_posts (
    post_date,
    post_date_gmt,
    post_content,
    post_title,
    post_excerpt,
    post_status,
    comment_status,
    ping_status,
    post_password,
    post_name,
    to_ping,
    pinged,
    post_modified,
    post_modified_gmt,
    post_content_filtered,
    post_parent,
    guid,
    menu_order,
    post_type,
    post_mime_type
  )
SELECT
  post_date,
  post_date_gmt,
  post_content,
  post_title,
  post_excerpt,
  post_status,
  comment_status,
  ping_status,
  post_password,
  post_name,
  to_ping,
  pinged,
  post_modified,
  post_modified_gmt,
  post_content_filtered,
  post_parent,
  guid,
  menu_order,
  post_type,
  post_mime_type
FROM
  wp_new_posts;


Notice that I did NOT include some of the columns in the INSERT or the SELECT section. This is because I kept getting errors about the primary keys already existing or some rubbish like that. When you leave a column out, it populates that column with empty data; in which a lot of cases, this is okay. Since the primary keys are not important, I decided to just let the SQL write whatever keys it felt like writing (this is what happens when you don’t specifying the primary key). Anyway; the Blog is up! enjoy.