WordPress with MariaDB instead of MySQL

So I heard good things about MariaDB and decided to switch from MySQL to MariaDB. MariaDB is a fork of MySQL developed by the original developers of MySQL and it is intended to be a drop in replacement – meaning all your commands and databases from MySQL should continue to work seamlessly after the switch.

Tall claim, but with years of relationships with webservers, it isn’t too tough to know that even an upgrade can break things. Here, however seamlessly, the DATABASE management software was being replaced. Only a complete novice would believe “as advertized” to the point of not being worried.

My biggest fear was breaking my blogs. Backups are there, but…. it is unpleasant to see your precious sites not working, and I was apprehensive.

So anyway, I did it.

Added the repository (these are my instructions, but they helpfully provide a configurator for customized MariaDB repositories for your Operating System – version – MariaDB version, which you should totally use).

sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
sudo add-apt-repository 'deb http://mirrors.hustunique.com/mariadb/repo/5.5/ubuntu saucy main'

I’d done paranoid backups to the nth degree before, as you should too, but I won’t bore you with the details. Suffice it to say that I had 3 of each database AND a snapshot of my VPS to restore with “one click” if I got itchy AND I copied the mysql directory anyway (I really love my blogs. Really). I think this was mostly of therapeutic value after the first backup, but hey, it was good for my blood pressure.

Updated and installed MariaDB.

sudo apt-get update
sudo apt-get install mariadb-server

The only pain here was that the repository I used was agonizingly slow to download from, which really did not help my anxiety levels, since I’m used to the more blazing fast ubuntu repositories. Or perhaps it was a temporary patch of bad network I hit.

Regardless, if you are superstitious, you may want to avoid this one.

After a wait that almost had me too old to care, the installation was done.

That is it. There was no noticeable difference to my site except seeming slightly faster. I noticed the configuration file got replaced, but the defaults are good enough that the blogs are completely normal. I expect once I get around to tweaking it, the performance may get even better, but this is good already.

The backups did not get used. A textbook “drop in”. Zero hassle.

Do it already. The only cure for your wondering is finding out.

Comments 8

  • Well how can we use MariaDB if we have share hosting ?

    • You can’t, unless your shared hosting provider is using MariaDB, which some do, I hear and with Google shifting to Maria DB, it is near guaranteed that both development as well as usage will increase.

      That said, I would recommend you try a Digital Ocean hosting (disclosure: affiliate link, but genuine recommendation). With VPS hosting with 512M RAM starting at $5 per month, there really is no excuse to continue paying for shared hosting and its environment limitations.

      In my view, it doesn’t make sense to shift to shared hosting for MariaDB, but it definitely does, to be able to use things like Nginx, pagespeed, APC and memcache, Varnish and such things that can add both features and speed to your website. The unique IP address can’t harm either.

  • Are you using MariaDB 10 verison or 5 version branch..I am wililng to try 10 branch..

    • I’m using the 5 branch. Had been planning to use the 10 branch, but never seem to find the time these days. I’m leery of doing such things in limited time, as I have crashed my system a few times in the past – or simply got into some configuration issue and such 🙁 Do let me know how it goes if you do.

  • Hi Vidyut,

    Thanks for this article.

    I wonder if you have using now the 10 branch of MariaDB and if things are running fine with your WordPress site(s).

    Also, would you say the 512 MB VPS from DigitalOcean is good enough for a site with 40,000~ visitors per month?

    Thanks!

    • This comment had been missed. It is old.

      For what it is worth, I am using the 10 branch for a while now. About the 512MB VPS from DigitalOcean… it is difficult to say. Probably depends more on what is going on in the backend. If the site is serving largely cached static pages, Id don’t see why it would be a problem. If you’re running it like an active social network type site, even half the number as active users could be hard. Performancewise, Nginx serves pages without a fuss. What will tax the 512MB is what goes on behind the scenes.

Leave a Reply

Your email address will not be published. Required fields are marked *