Is Your WordPress Site Slow? Problem May Lie With MySQL, Here is How to Fix it

When I initially started out with using VPS, I had tons of problems with Apache but quickly switched to Nginx which has proven to be more than a boon, because it meant that I could do more with less. However, having used WordPress I have come to know that the system is not necessarily scalable in itself when it comes to self-hosted websites.

In the past, I have written about the architecture that powers Techie Buzz and several guides like Scaling WordPress Using MySQL Replication and HyperDB and setting up memcache with WordPress among others.

However, over time, I have learned quite a few things about managing WordPress for a website with heavy traffic and also sorted out several issues which had become a bottleneck for us.

One of the biggest issues I have faced over time with WordPress is the database. More often than not WordPress websites work slower than expected because of the MySQL database and heavy load on it. However, many a times a simple change in MySQL could speed up the website considerably.

The default engine (not forced by WordPress) while installing WordPress is MyISAM for most hosting companies. The problem with MyISAM is that it locks the entire table when it inserts or updates rows. This in turn locks other queries which are accessing the same table slowing down the entire website in the process.

For example, when you are updating a post, you will be updating the wp_posts table and during this update all other select, insert, update and delete queries will be queued till the insert/update query completes. This in itself should not be a big problem when you have a site with less traffic. However, it does make a big impact when you have a large website with multiple queries being run every minute or so.

So what is the solution for this? Well, the best I could implement was switching the tables with the frequent queries to InnoDB. InnoDB is a storage engine in MySQL which might become the default one in future MySQL versions. With an InnoDB table the queries don’t lock the entire table, but just lock a single row it is inserting/updating. This leaves the other queries to complete without having to wait in a queue.

Making this small change has definitely made life easier for us. Along with our other caching mechanisms we now have almost 0 load on our database, which is definitely a great thing.

While this has definitely been helpful for us, I would suggest that you spend some time reading up the differences between MyISAM and InnoDB and their advantages and disadvantages before you make the move. Once you are convinced that you are ready to migrate, head over to my earlier guide on how to safely and easily migrate tables from MyISAM to InnoDB Engine.

How To Migrate From MyISAM to InnoDB in MySQL Safely and Easily

Since the time that I have run this site, I have had my fights with keeping the website running smoothly. However, over time, I have identified several areas we need to improve on and one of them has been MySQL.

The problem I have had with MySQL is whether to use the MyISAM engine or the InnoDB engine. I have more recently tilted towards using InnoDB more often than not because of the advantages it has for a high traffic website. Though, I won’t go over the advantages in detail here, I might ask you to read my article on why we switched to InnoDB.

Nevertheless, here is a quick and easy tutorial on how to switch from a MyISAM engine to a InnoDB engine safely and easily. You can run these queries on the command prompt or use a GUI like PHP MyAdmin as well. However, you must note that the data in your MyISAM table might not be similar to your new table due to frequent updates and you might want to plan downtime so that you don’t lose data or have to sync the tables again.

So without further ado, here are the steps:

Create a Replica Table

The first step is to create a replica table of the one you want to switch the engines for, for that run the query given below. Make sure to replace the table names as appropriate.

CREATE TABLE new_table LIKE old_table;

Once you have run this query you’ll have a new table which has the same schema as the older table and you are already on your way.

Drop FULLTEXT Indexes in New Table

The biggest difference, if you measure it that way is that InnoDB tables do not support FULLTEXT indexes. So before we do anything else you will have to drop the FULLTEXT indexes from the table you just created. To do that follow the steps given below.

Run the query:

SHOW INDEX from new_table where index_type=’FULLTEXT';

Drop individual indexes from the query (rename indexname for the index you want to drop):

ALTER TABLE new_table DROP INDEX indexname;

Once you have done that, you are now ready to move your MyISAM table to the InnoDB engine. So lets get ahead with it.

Moving MyISAM Table to InnoDB Engine

The next move is to update the Engine of your MySQL table to InnoDB. For that, you will have to run the following query:

ALTER TABLE new_table ENGINE = InnoDB;

That’s it. You now have the new table in InnoDB format, now you just need to move the data.

Move Data From Old Table to New Table

You will need to move the data from the old table to the new table. To do that, run the following query:

INSERT new_table SELECT * FROM old_table;

And the data is finally there. The last but not the least step is to switch between your older MyISAM table to your new InnoDB table.

Rename Old Table to Backup and New Table to Old

Run the following queries to rename your tables:

Rename Table old_table TO old_table_backup;

Rename Table new_table TO old_table;

That’s it. You have now successfully migrated your MyISAM table to the InnoDB engine while having a backup which you can quickly switch to by renaming the backup table again.

Oracle Assumes MySQL is Open Core, Invites the Wrath of the Open Source Community

There has to be a day when Oracle stops disappointing the world of open source. Right after the acquisition of Sun Microsystems, everything Oracle has done took open-source projects under Sun Microsystems on a slide downhill. Recently,  many publications  are talking about  MySQL becoming open-core  but if we look closely, Oracle started out with this very outlook for MySQL! To be precise, Oracle says in  its announcement of commercial extensions  for MySQL,

Continuing the business model of MySQL, we are adding three new commercial extensions to MySQL Enterprise Edition.
Existing commercial customers who are entitled to a  MySQL Enterprise Edition  subscription can log into My Oracle Support and download these immediately.
For others who want to try these new capabilities, we will make them available shortly, via the  30-day
free trial of MySQL Enterprise Edition

Tell me why that does not sound familiar. We have seen this ideology earlier. Both Eclipse and Cygwin are based on the ideology of  Open Core  and MySQL seems to be taking the same path. Something about this open-core does not seem right. At least, it does not fall in line with the four basic freedoms of free-software, namely,

  • The freedom to run the program, for any purpose (freedom 0)
  • The freedom to study how the program works, and change it so it does your computing as you wish (freedom 1)
  • The freedom to redistribute copies so you can help your neighbor (freedom 2)
  • The freedom to distribute copies of your modified versions to others (freedom 3)

Open core maintains a feeling of goodwill while taking away the aesthetic value of these freedoms. With this move, Oracle shows that it has the right to distribute MySQL components as commercial products. In other words, what would otherwise have arrived, as an enhanced version of MySQL with added features, will come as MySQL with commercial enhancements. Database Compromised By Blind SQL Injection

An email was sent out earlier today on the Full-Disclosure mailing list, detailing the compromise of numerous MySQL websites along with portions of their database containing usernames and passwords.


MySQL offers database software and services for businesses at an enterprise level as well as services for online retailers, web forums and even governments. The vulnerability for the attack, completed using blind SQL injection and targeted servers including,, and, was initially found by "TinKode" and "Ne0h" of Slacker.Ro (according to their dump of the stolen credentials) but published by "Jackh4x0r".

The stolen database contain both member and employee email addresses and credentials, as well as tables with customer and partner information and internal network details. Hashes from the database have been posted, with some having been already cracked.

A submission to also details an XSS (Cross Site Scripting) vulnerability affecting that may have provided a secondary entry point for compromising visitors or employees with the organization since early January of 2011.

This is definitely a shame for the folks behind MySQL since they were bought by Sun and later on by Oracle (through the Sun acquisition). MySQL is used by millions of users for small and medium sized databases, including by the popular blogging software WordPress.

The email sent to Full Disclosure lists out all the databases, tables and even some password hashes for the users at There has been no response from MySQL on this issue yet. We have contacted them for a comment and will update this post once more information becomes available.

More updates coming soon….

Update: This hack also compromised the database at, more info on this at

MySQL And Java Doing Well Under Oracle

After the drama over OpenSolaris a few days back, one might be tempted to think that the other Sun Microsystems products like MySQL and Java would be having problems too.

Well, according to a developer survey conducted by Jaspersoft, Java and MySQL has not been affected much by Oracle’s acquisition of Sun Microsystems. In fact, they are doing quite well under Oracle.

Here are some interesting things from the survey:

  • More than 75 percent of respondents said their use of MySQL would increase or stay the same under Oracle.
  • More than 75 percent of respondents predicted that MySQL development would continue at the same pace and even improve under Oracle.
  • Almost all respondents said they’d continue to use Java, or increase the use of Java in their organization, under Oracle. These results say Java is still a vibrant and popular programming language.
  • Nearly 80 percent of respondents felt that the Java Community Process (JCP) would remain the same or improve under Oracle.

The result for Java is not surprising considering the fact that there are not many alternatives to Java right now. However, despite the availability of the other database management systems, most of the developers still prefer MySQL.  So yes the developers still trust Oracle to keep MySQL and Java alive.

However, it would be wrong to compare this with the issue surrounding OpenSolaris. Java and MySQL are very widely used and Oracle can only gain by continuing to support them. The case is different with OpenSolaris though. OpenSolaris is almost non-existent in desktops; even for supercomputers only 2 of TOP500 supercomputers run on OpenSolaris.

[via: cnet news]

Auto Backup for MySQL Database

If you have a blog or a regular website which makes use of a database to store information, there could be times when the database crashes or for that matter your hosting provider does. In such cases, having backups of your MySQL database is really very very important.

Of course there are several ways to backup your MySQL data, however, most of those require manual intervention and can be easily forgotten.


Auto Backup for MySQL is a MySQL Backup Solution which allows users to schedule the backing up and restoring of your remote and local MySQL Database. Auto Backup for MySQL allows you to create different tasks to backup or restore MySQL database. You can choose to automatically backup MySQL database to SQL files or also choose to upload them another server or to another database altogether.

In addition to the above tasks you can also export the MySQL tables to CSV, XML, HTML or Text files and execute regular MySQL queries on the database.

Once you choose a task, the software will walk you through a wizard which will create the steps required to perform the task. For detailed instruction on creating a task using Auto Backup for MySQL you can visit this post.

Techie Buzz Verdict

Considering that the database is the most important part of any website or blog, Auto Backup for MySQL is definitely a useful software. Using the software you can schedule backups to occur at regular intervals, thus ensuring that you have backups in case your database or host crashes.

However, the only problem I saw with the software is that it expects that the host allows connection from external IP address, whereas many servers come with installations which restrict database access to only local machine. It would be good if the software could allow for SSH tunneling through which it could backup the database too.

Auto Backup for MySQL is available as a free trial for 15 days, after which you can buy different editions of the software starting at $59.95.

Download  Link:

Pro Link:

This is a sponsored review of the software, all views in the post are unbiased and true.

Facebook is Sponsoring and Hiring From TopCoder

Facebook employees are an elite group of coders, engineers and entrepreneurs who have all it takes to manage the 400+ million user base Facebook has developed over years. The Facebook team is extremely small and the ratio of a Facebook engineer to Facebook users is more than one million. This is possibly the largest ratio amongst all tech giants.

Facebook is now a part of 2010 TopCoder(R) Open as a sponsor. It also has plans of taking in winners as interns and full time employees. Facebook says,

Help develop the second most-trafficked site and one of the largest MySQL installations in the world.

Facebook uses PHP, C++, Python, Java and Erlang besides other languages.

Every technology has some form of a limit. Tech companies like Facebook hack these technologies to scale them according to their needs and go beyond that limit. Facebook uses Cassandra, Hive, Scribe, and Thrift open source projects and is active in developing them as well.

Facebook boasts more by saying,

At Facebook, we move fast. Our rapid development cycle is supported by tools that always keep us operating ahead of the curve. Our engineers are able to write code and have it running live on the site that same night – see the impact you’re making in real-time.

Learn more at the page.

Oracle’s Decision on MySQL

Discarding all the fuss made over the future of MySQL, Oracle clarified its plans to continue improving MySQL, and do it even better than Sun. Not only this, Edward Screven said, Oracle aims to improve many of MySQL features to make them compatible with Oracle apps.

Edward Screven, the chief corporate architect will now overlook the development of Open Source projects from the Oracles Open Source Software Division, like MySQL and Screven has hopes of delivering complete, open and integrated systems and challenge IBM in this respect. IBM, before this deal was the largest and unchallenged Open Source Enterprise giant providing an overall experience.

One thing which is not clearly said yet is if the extensions made to MySQL will be made as an Open Source or a closed source project but the promise of a support will definitely benefit the MySQL developer community numbered at around 400.

At the same time, the argument of “There is no point in developing two softwares for the same task” seems valid as well. My best guess is, Oracle will slowly push out MySQL which had started entering the enterprise market and establish it’s position as a web based database server. This will keep the two softwares channeled to specific users and Oracle and MySQL will both improve only if they are better in their fields and do not collide.

Help MySQL at

MySQL fans from around the world have joined forces to save the project from going into the hands of database giant Oracle, which has set out to buy Sun Microsystems. Sun Microsystems is the current owner of MySQL, the open source database which is extremely famous all over the world as a database server for websites.


Most of the web servers in this world are running on a LAMP server in which, M represents MySQL with L, A and P for Linux, Apache and PHP respectively. MySQL enthusiasts fear that once Oracle acquires Sun Microsystems, the MySQL project will be left at the mercy of Oracle which might as well decide to shut the project down. Speculations are, after the acquisition, Oracle will level out all competition against its primary product and will also increase costs and licensing fees. This will make the small scale businesses pay badly.

The fear has led to MySQL fans creating a campaign and a website to host their cause at

Some interesting facts at this post of the blog of the MySQL creator Michael “Monty” Widenius, are:

  • Oracle has offered to buy MySQL twice before.
  • Oracle faces losses amounting to $1 billion USD per year because of MySQL.
  • Rumors are that the recent Sun layoff were hijacked by Oracle, many of the fred were from MySQL group.
  • Oracle’s last acquisition of Open Source software, InnoDB resulted in slow-down of development.
  • One major demand of the helpmysql campaign is that MySQL be released under Apache Software License now and forever.
  • According to a poll, there is only a 0.7% of people who trust Oracle on MySQL.

With these fishy things going on, we should really go ahead and support the MySQL community. You can visit the website and offer any help you can.

MySQL Founder Pleads to Save MySQL from Oracle

mysql_oracle_sun MySQL was originally purchased by Sun Microsystems, who were in turn purchased by Oracle. This change in deal has probably got the founder of MySQL, Michael Widenius a bit emotional. In a recent blog post, he pleads with the community to save MySQL from the clutches of Oracle.

For those of you who are in the unawares, Oracle is the creator of one of the largest relational database in use today and has several products which help manages huge businesses, their closest rival in business products being SAP.

In the blog post, which you can read here, MySQL’s creator has some really strong opinions about the deal, and pleads against Sun being taken over by Oracle, who will eventually take over MySQL through the Sun Microsystems deal, which is still hanging in balance due to European Commission taking a look into the deal.

I, Michael "Monty" Widenius, the creator of MySQL, is asking you urgently to help save MySQL from Oracle’s clutches. Without your immediate help Oracle might get to own MySQL any day now. By writing to the European Commission (EC) you can support this cause and help secure the future development of the product MySQL as an Open Source project.

MySQL is the favorite database of the masses and many websites run on the small scale but hugely popular database. MySQL’s future was questioned when it sold to Sun, for one it was Open source and not many in the community were happy with the deal back then. Most WordPress based websites are powered by MySQL and so are sites running other CMS software like Joomla and Drupal.

With Oracle taking over MySQL, there is very good chance that MySQL will stop being a Open Source Product, albeit it will be very unwise for Oracle to stop giving out MySQL as a free product, and it would definitely spell disaster for them.

What is your take on this? Do you think that MySQL will survive once it goes under the Oracle banner? Let your thoughts flow through the comments.

Thanks @iMBA.

Image Credit Sitepoint