Replace MySQL with MariaDB
* PLEASE NOTE *
Consider using Docker instead!
It think it's time for a change. I don't know if you got the news but MySQL man pages silently licensed away from GPL.
So what about switching to a better, optimize and faster solution? Yes, I am talking about MariaDB!
Before you start, you have to know which version you want between 10.0.x and 5.5. The major difference is MariaDB 10.0 has more features than 5.5:
- Multi-source Replication
- NoSQL Cassandra Storage Engine
- Engine Independent Statistics
- SHOW EXPLAIN of a running thread
- InnoDB Improvements
- Performance Schema Improvements
The full list is available at: http://www.skysql.com/blogs/max-mether/mysql-56-vs-mariadb-100
Prepare the installation
sudo apt-get install python-software-properties sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
sudo add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/10.0/ubuntu precise main
sudo add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu precise main
You can change the source and version at: https://downloads.mariadb.org/mariadb/repositories/
If you install version 10.0 you will probably need to recompile the PHP with MariaDB to use the latest version. Otherwise, you will see a notice like this:
---Warning: mysqli::mysqli() [mysqli.mysqli]: Headers and client library minor version mismatch.
You can also create a custom MariaDB sources.list file. To do so, copy and paste the following into a file under
(we suggest naming the file MariaDB.list or something similar), or add it to the bottom of your /etc/apt/sources.list file.
# MariaDB 5.5 repository list - created 2013-06-24 12:18 UTC # http://mariadb.org/mariadb/repositories/ deb http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu precise main deb-src http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu precise main
Now, let's install it.
sudo apt-get update sudo apt-get install mariadb-server mariadb-client libmariadbclient-dev libmariadbd-dev
The service should start automatically, if it does not you can run it manually:
sudo /etc/init.d/mysql start
Test the install
service mysql status * /usr/bin/mysqladmin Ver 9.1 Distrib 10.0.3-MariaDB, for debian-linux-gnu on i686 Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others. Server version 10.0.3-MariaDB-1~precise-log Protocol version 10 Connection Localhost via UNIX socket UNIX socket /var/run/mysqld/mysqld.sock Uptime: 1 hour 2 min 7 sec Threads: 1 Questions: 118 Slow queries: 0 Opens: 103 Flush tables: 2 Open tables: 79 Queries per second avg: 0.031
Then when you type:
You should see:
mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 44 Server version: 10.0.3-MariaDB-1~precise-log mariadb.org binary distribution Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>