Archive for the ‘ sql ’ Category

Automatically Backup Your WordPress Site to Google Drive – Version 2

We have released new version(v2) on wp google drive plugin to make back of your wordpress site files to google drive in efeectivemanner.

Exclusive tutorial on How to Backup your WordPress blog to Google Drive. It is always recommended to backup your WordPress blog, which includes files (themes, plugins etc) and SQL tables (all your blog posts, comments, drafts etc are stored as tables in database).

Whenever your blog is gone (due to unsecured activities or some other reasons), these backups will help to get back your blog. In some cases, using 3rd party plugins and themes can also lead to malfunction of your blog, here also these backups helps to retain back your blog.

Reasons to Backup WordPress Blog to Google Drive

  • Its a Google Product and is free to use up-to 5GB.
  • Can get access to backups on any of the devices like Smartphones, Tablet PC’s, Laptops etc.
  • Backups will be uploaded in quite less time (sometimes based on internet connection also).
  • Highly Secure and reliable service, so there wont be any loss of data in the process.
  • Backups can be shared with your blog partners (if have any) with a single click of mouse

How to Backup WordPress blog to Google Drive

Download and Install Google Drive for WordPress plugin from official WordPress plugin repository.

Google Drive for WordPress Plugin »

Please see the video for plugin process.

Here is the step-by-step guide that helps to backup your WordPress blog to Google Drive. Brief list of things you have to do in this tutorial:

  1. Login to Google API and create a Client ID in it.
  2. Authorizing the Plugin by using Client ID and Client Secret.
  3. Setting up the plugin frequency to take backups.


  • Go to “API Access” tab and click on “Create an OAuth 2.0 client ID”



  • Go to “API Access” tab and click on “Create an OAuth 2.0 client ID”


  • In the pop-up window, give a product name and upload logo before clicking on “Next” button.


  • By default “Web Application” will be selected and don’t change it.


  • In “Your site or hostname” section, click on “More Options” to expand link sections.


  • Now, paste the link in the “Backup Settings” page here. Enter domain name in “JavaScripts” origin field.


  • Click on “Create Client ID” and you have successfully created a Client ID using Google API Console.


  • Copy the Client ID and Client Secret from API dashboard and paste them in “Configure Google” page.

  • You have to authorize the plugin by clicking on “Allow Access” button.


  • Allow Access to the Plugin and the entire setup has been successfully installed.

Check Out : WordPress Plugin

How to automatically Backup WordPress blog to Google Drive

  • Now, you can configure this plugin further by entering the custom folder ID of your Google Drive.
  • Also define the maximum number of backups (use any positive integer in that field).
  • Set the frequency of backup and everything will be automatically stored in your Google Drive.

    Backup Settings:

    1. You can name your backup directory, any name you like just enter it on text box.
    2. Mail Options : Enable this option to receive mail notification after successful backup on google drive.
    3. Schedule Backup:You can schedule a backup duration here. Based upon the Scheduled time, it will automatically perform schedule backup to google drive.
    4. Manage database :
    –Check yes, if you want to keep Database backup
    –Check the option if you want to exclude particular tables from backup
    –Always keep a recent backup of your site.Here you have option to keep most recent backups.
    Select how many you want to maintain on your server.
    –If you want, you can move particular backup folder to google drive.
    5. Manage Files:
    –Check option to exclude files from backup
    –Select how many backups you would like to maintain on your server.
    –If you want, you can move particular backup folder to Google drive.
    6. On-time backup: For immediate backup.


    Both schedule backup and Ontime backup will works based upon your files selection on Manage database and Manage Files section.



The PHP logo displaying the Handel Gothic font.

SecureNext Software

We plan to recruit 5 PHP developers with 2-3 years experience in our Chennai branch. The candidate should have a minimum 1.5 years experience as a PHP developer. A quick learner and a team player is an added advantage. The referred candidate must commit to serve the company for at least 2 years. If you know anybody who is meeting all the above requirements and is looking for a change, please refer them and ask them to send their resumes to &

We want to close this recruitment in a week’s time and hence would appreciate a quick response !.. If the candidate referred by you is selected, then, you will get the referral bonus per selected profile as per the company rules and guidelines.

Job Description:-

For PHP openings, We need the following skill set :.

Edu.Qlfn: BE ( CSE / IT / EEE), MCA, MS (CS)

1) Should have minimum 1 year 6 month experience in PHP development

2) Good & hands-on knowledge in PHP, MYSQL, Jquery and CSS
3) A Fair knowledge in Joomla, wordpress and drupal will be an added advantage

We need the following details

Current CTC / Nett take home p.m.

Expected CTC / Nett take home p.m.

Referred By

Number of days required to Join

Reason for changing Job

WordPress 3.2 to Drop Support for PHP 4 and MySQL 4

WordPress has announced a bold move today. In an official blog post Mark Jaquith, one of the lead developers

of WordPress said that eventually, starting this year WordPress will end the support for PHP 4 and MySQL 4.



Quoting from the blog post, the reasons he gave were:

Our approach with WordPress has always been to make it run on common server configurations. We want users to have flexibility when choosing a host for their precious content. Because of this strategy, WordPress runs pretty much anywhere. Web hosting platforms, however, change over time, and we occasionally are able to reevaluate some of the requirements for running WordPress. Now is one of those times. You probably guessed it from the title — we’re finally ready to announce the end of support for PHP 4 and MySQL 4!

According to the official announcement, WordPress 3.1 which is due to be announced in late 2010 will be the last build to support PHP 4. Also WordPress 3.2 which should come anytime around first half of 2011, the compatibility will be fixed to PHP 5.2. Also for MySQL, announcement made on the blog post was:

In less exciting news, we are also going to be dropping support for MySQL 4 after WordPress 3.1. Fewer than 6 percent of WordPress users are running MySQL 4. The new required MySQL version for WordPress 3.2 will be 5.0.15.

In order to check, which version of PHP and MySQL your hosting provider provides, you can make use of Health Check plugin. This plugin will tell you, if you are ready to be upgraded to WordPress 3.2 when it is available. If you are not ready for it, your blog will not be able to upgrade to WordPress 3.2 because of an inbuilt adapter, which stops it.

According to us, this announcement is surely a bold move, but should not take much concerns for most of the blog owners as statistics show that very less number of trivial blogs only run on PHP4. But still if you are unaware of the version of PHP and MySQL that your hosting provider provides, you better keep an eye on it and check it before it’s too late for you to upgrade to latest version of WordPress.

Source: , WordPress

What is RSS Feed?

One of my friends visited my blog and was really interested to get auto update on new learning that I might post and was wondering how he could do that, that’s when I said subscribe to RSS feeds(Really Simple Syndication). This triggered his inquisitiveness and I could not spend time explaining what it was and how one can find more RSS feeds and subscribe to it. Though I directed him to do his own search, I thought let me find a link that gives ‘All about RSS feeds’ in one place instead of searching and clicking on one or more links and deciding which one to read.

In the below link which takes you to IBM site, author James Lewin explains it all about RSS Feeds. Hope my friend will find it useful and wouldn’t be mad at me. Enjoy reading!

13 SQL Queries for WordPress

13 SQL Queries for WordPress

An easy way to run any of the queries below is to use phpMyAdmin. phpMyAdmin is one of the most common database look-up and editing tool. Almost all the web hosting services’ control panels provide this. There is also WordPress SQL Executioner – a WordPress plugin that allow you to execute your SQL query.

To use phpMyAdmin follow the steps below:

1. Login to phpMyAdmin panel and select your WordPress database.
2. Click on the SQL tab which will bring you to a page with a SQL query box.

Once you see the SQL query box, like the image shown below, you can run your SQL query there.

SQL Query Box

Note: All queries are direct SQL queries and will assume the standard table prefix ‘wp_’ for tables. If you are using a different table prefix, please modify queries accordingly.
Change Siteurl & Homeurl

WordPress stores the absolute path of the site URL and home URL in the database. Therefore, if you transfer your WordPress site from the localhost to your server, your site will not load online. This is because the absolute path URL is still pointing to your localhost. You will need to change the site URL and the home URL in order for the site to work.

view source
1 UPDATE wp_options SET option_value = replace(option_value, ‘’, ‘’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;
Change GUID

After you have migrated your blog from the localhost to your server or from another domain to a new domain, you will need to fix the URLs for the GUID field in wp_posts table. This is crucial because GUID is used to translate your post or page slug to the correct article absolute path if it is entered wrongly.

view source
1 UPDATE wp_posts SET guid = REPLACE (guid, ‘’, ‘’);
Change URL in Content

WordPress uses absolute path in the URL link instead of a relative path in the URL link when storing them in the database. Within the content of each post record, it stores all the old URLs referencing the old source. Therefore you will need to change all these URLs to the new domain location.

view source
1 UPDATE wp_posts SET post_content = REPLACE (post_content, ‘’, ‘’);
Change Image Path Only

If you decide to use Amazon CloudFront as your Content Delivery Network (CDN) to offload the delivery of images from your server. After your have created your CNAME record, you can use the query below to change all the image paths in WordPress to load all your images from Amazon CloudFront.

view source
1 UPDATE wp_posts SET post_content = REPLACE (post_content, ‘src=”’, ‘src=”’);

You will also need to update the GUID for Image Attachment with the following query:
view source
1 UPDATE wp_posts SET guid = REPLACE (guid, ‘’, ‘’) WHERE post_type = ‘attachment’;
Update Post Meta

Updating Post Meta works almost the same way as updating the URL in post content. If you have stored extra URL data for each post, you can use the follow query to change all of them.

view source
1 UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, ‘’,’’);
Change Default “Admin” Username

Every default WordPress installation will create an account with a default Admin username. This is wide spread knowledge, everyone who uses WordPress knows this. However, this can be a security issue because a hacker can brutal force your WordPress admin panel. If you can change your default “Admin” username, you will give your WordPress admin panel additional security.

view source
1 UPDATE wp_users SET user_login = ‘Your New Username’ WHERE user_login = ‘Admin’;
Reset Password

Ever wanted to reset your password in WordPress, but cannot seem to use the reset password section whatever the reason?

view source
1 UPDATE wp_users SET user_pass = MD5( ‘new_password’ ) WHERE user_login = ‘your-username’;
Assign all articles by Author B to Author A

If you want to transfer the articles under Author B to merge with those under Author A, it will be very time consuming if you do it article by article. With the following SQL query, you can easily go through all the records and assign articles by Author B to go under Author A.

You will first need to obtain the author ID of both authors by going to your Author & User page in your WordPress admin panel. Click on the author’s name to view their profile. At the address bar, look for “user_id”. That is the author ID information we require.

view source
1 UPDATE wp_posts SET post_author = ‘new-author-id’ WHERE post_author = ‘old-author-id’;
Delete Revision

When you are editing an article in WordPress, there will be many revision copies being saved. This is a waste of resources because excessive revision records can increase the burden of the database. Over time, when you have thousands of entries, your database will have grown significantly. This will increase loop iterations, data retrieval and will affect the page loading time.

view source
1 DELETE a,b,c FROM wp_posts a
2 LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)
3 LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)
4 WHERE a.post_type = ‘revision’

Source from: Lester chan

Note: Bear in mind that all revisions from each post will be deleted, including all of its meta data.
Delete Post Meta

Installing or removing plugins is a very common task for WordPress. Some of the plugins make use of the post meta to store data pertaining to the plugin. After you have removed the plugin, those data are still left inside the post_meta table, which will no longer be needed. Run the following query to clean up the unused post meta value. This will help to speed up and reduce the size of your database.

view source
1 DELETE FROM wp_postmeta WHERE meta_key = ‘your-meta-key’;
Export all Comment Emails with no Duplicate

Over a period of time, your blog will have received many comments. These comments will include the email addresses left by the commenter. You can retrieve all these emails for your mailing list without any duplicate.

view source
1 SELECT DISTINCT comment_author_email FROM wp_comments;

Once you have the result, under Query results operations, select export to export all the emails in phpMyAdmin.
Delete all Pingback

Popular articles receive plenty of pingback. When this happens, the size of your database increases. In order to reduce size of the database, you can try removing all the pingbacks.

view source
1 DELETE FROM wp_comments WHERE comment_type = ‘pingback’;
Delete all Spam Comments

If you have plenty of spam comments, going through each page to delete spam can be tedious and frustrating. With the following SQL query, even if you have to face deleting 500 over spam comments, it will be a breeze.

view source
1 DELETE FROM wp_comments WHERE comment_approved = ‘spam’;

* 0 = Comment Awaiting Moderation
* 1 = Approved Comment
* spam = Comment marked as Spam

Identify Unused Tags

In a WordPress database, if you run a query to delete old posts manually from MySQL, the old tags will remain and appear in your tag cloud/listing. This query allows you to identify the unused tags.

view source
1 SELECT * From wp_terms wt
2 INNER JOIN wp_term_taxonomy wtt ON wt.term_id=wtt.term_id WHERE wtt.taxonomy=’post_tag’ AND wtt.count=0;

%d bloggers like this: