MariaDB on DirectAdmin (Replace MySQL with MariaDB)

Replace MySQL with MariaDB on DirectAdmin


MySQL…It seems these days everybody doing something in the IT branch has used it, or still does. However, there are some problems: you only get the fun stuff (like clustering etc) if you pay big time, its development is stalling (more and more core developers are leaving), a seemingly evil company is running it, and last but not least, the community is being excluded.

There is a solution though. It’s called MariaDB. It’s forks of MySQL, and was started by Michael Widenius (aka Monty), the original author of MySQL. It’s a project that actually is as open to the community as can be, releases all its code under a truly open license like the BSD/MIT license whenever possible and is able to add new functionality at a much faster pace than Oracle does. Last but not least and it’s 100% backwards compatible with MySQL, and therefore can be used as a drop-in replacement.

I assume the first thing you want to do now is replace MySQL on your server/pc with MariaDB, but if you want to read/know more about MariaDB first, you can always check out the source code, see its launchpad page, checkout the contribute page, join all experts on Freenode (irc).

I’ll make some more assumptions.

  • I assume that you backed up the universe & everything around it.
  • MySQL was running fine before upgrading.
  • MySQL’s version is either 5.0 or 5.1.
  • You’re running CentOS 6.x x64bit (chances are that on different distros this will work just as well).

Installing it is relatively simple, we stop & remove mysql, we download & extract, install another version of the init script:

Note: This method is an example with MySQL from DirectAdmin with CustomBuild 2.0 Beta.

echo -e "[client]\nuser=da_admin\npassword=`grep "^passwd=" /usr/local/directadmin/conf/mysql.conf | cut -d= -f2`\nsocket=/var/lib/mysql/mysql.sock" > /root/.my.cnf;
cd /usr/src;
wget -O /usr/src/mariadb-10.0.15-linux-x86_64.tar.gz;
tar -zxvf mariadb-10.0.15-linux-x86_64.tar.gz;
mv mariadb-10.0.15-linux-x86_64 mariadb; 
mv mariadb /usr/local/mariadb;
/etc/init.d/mysqld stop;
yum remove mysql -y;
cd /usr/local/mariadb/;
./scripts/mysql_install_db --user=mysql;
/bin/cp -rvf support-files/mysql.server /etc/init.d/mysqld;
ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock;
chown -R root .;
chown -R mysql data;
sed -i 's/basedir=/basedir=\/usr\/local\/mariadb\//g' /etc/init.d/mysqld;
sed -i 's/datadir=/datadir=\/var\/lib\/mysql\//g' /etc/init.d/mysqld;
killall -9 mysqld;
killall -9 mysql;
/etc/init.d/mysqld start;
mysql_upgrade -uda_admin -p`grep "^passwd=" /usr/local/directadmin/conf/mysql.conf | cut -d= -f2`
/etc/init.d/mysqld restart;


 Successfully test with mysql command

MySQL command login to terminal, shown MariaDB version.

Successfully test with mysql command with your user + pass, MySQL command login to terminal, shown MariaDB version.