Nội dung
1. Overview
In this article, AZDIGI will show you how to convert MySQL to MariaDB on DirectAdmin as well as how to install the latest version of MariaDB.
For some reason, you want to use MariaDB rather than MySQL like:
- Supports more storage engines.
- Released after MySQL.
- Is a true open source because currently MySQL is governed by oracle and not operated by the community.
- MariaDB is maintained by the creators of MySQL.
- Fully compatible with MySQL.
- More cool features.
2. Technical comparison between MariaDB and MySQL
MariaDB | MySQL | |
Developers | MariaDB Corporation AB (MariaDB Enterprise) and MariaDB Foundation (community MariaDB Server) | Oracle |
Released for the first time | 2009 | 1995 |
Current release | 10.3.10, October 2018 | 8.0.12, July 2018 |
License | Open source | Open source + proprietary |
Develop | Open | Close |
Storage Tools | InnoDB MyISAM BLACKHOLE CSV MEMORY ARCHIVE MERGE ColumnStore MyRocks Aria SphinxSE TokuDB CONNECT SEQUENCE Spider Cassandra | InnoDB MyISAM BLACKHOLE CSV MEMORY ARCHIVE MERGE |
SQL Management | HeidiSQL | MySQL Workbench |
Deployment language | C and C++ | C and C++ |
Server OS | FreeBSD Linux Solaris Windows | FreeBSD Linux OS X Solaris Windows |
API | Proprietary native API ADO.NET JDBC ODBC | Proprietary native API ADO.NET JDBC ODBC |
Supported programming languages | Ada C C# C++ D Eiffel Erlang Go Haskell Java JavaScript (Node.js) Objective-C OCaml Perl PHP Python Ruby Scheme Tcl | Ada C C# C++ D Delphi Eiffel Erlang Haskell Java JavaScript (Node.js) Objective-C OCaml Perl PHP Python Ruby Scheme Tcl |
Customer | Booking.com, Wikipedia, Google, Canal+, ClubMed, Deutsche Telekom, La Poste, Virgin… | NASA, US Navy, Spotify, Netflix, Nokia, Joomla, Uber, PHP-Nuke, Tesla, Fujitsu… |
Market | Default MariaDB in LAMP | Default MySQL in AppServ |
3. Instructions to switch MySQL to MariaDB on DirectAdmin
To convert MySQL to MariaDB on DirectAdmin, we need to do the following 3 steps.
Step 1: SSH into your DirectAdmin system
To convert MySQL to MariaDB on DirectAdmin, we need to SSH or access your VPS/server with root privileges first. If you do not know how to SSH into your VPS or Server, you can refer to the following tutorial:
After successfully SSHing, we continue with step 2 to start the process of converting MySQL to MariaDB on DirectAdmin.
Step 2: Check the current version of MySQL in use
The check also ensures that we are using MySQL only because many cases have been running MariaDB without you knowing. To check the current version of Mysql, we use the following command:
mysqld -V
The image below is my result, with the currently installed version of 5.6.48.
Now that you have checked the current version of MySQL in use, we continue with step 3 to covert MySQL to MariaDB on DirectAdmin.
NOTE: Risks cannot be ignored and data safety is still the most important, so before upgrading to MariaDB, you need to back up your entire database.
Step 3: Convert MySQL to MariaDB on DirectAdminin with CustomBuild 2.0
First, we need to check if the version of CustomBuild we are using is 2.0 or not. To check the version of CustomBuild you are using, please check out the following short tutorial:
In case your CustomBuild version is lower than 2.0 then you need to upgrade CustomBuild 1.x to 2.0 , you can check out the following tutorial:
After you have upgraded to CustomBuild 2.0, run the following commands to upgrade MySQL on DirectAdmin:
cd /usr/local/directadmin/custombuild ./build set mariadb 10.5 ./build set mysql_inst mariadb ./build set mysql_backup yes ./build update ./build mariadb
Explanation of the above commands:
- Command 1: Move to custombuild folder.
- Command 2: Adjust the configuration of the MariaDB version to the latest version of 10.5, you can follow the newer versions at the MariaDB homepage.
- Command 3: Use the database management system is MariaDB (there are 2 options 1 is Mysql, 2 is MariaDB).
- Command 4: Adjust the configuration to enable database backup before running the installation command.
- Command 5: Update custombuild script.
- Command 6: Start the conversion from Mysql to MariaDB.
More information: at the moment I write this article, there is only 10.5 MariaDB version 10.5, so when you change it to 10.6 it will not be valid, but in the future, it may be valid after MariaDB releases this version. Below is a picture of when I tried to adjust the version to 10.6.
The installation time will depend on the strength of your VPS/Server and the connection at that time because, in this process, it is necessary to download some quite heavy installation files. The installation process on my VPS 4 CPU Cores is 4 minutes.
Another small note that affects your installation time is that during the installation process, the system will automatically dump all existing databases into a directory to avoid data loss or errors. Therefore, if your VPS/Server has a lot of databases, the installation time will be longer.
To check where the directory containing the database is dumped, use the following 2 commands:
cd /usr/local/directadmin/custombuild cat options.conf | grep mysql_backup_dir
Here my directory will be /usr/local/directadmin/custombuild/mysql_backups
.
After the installation is complete, the screen will show as below:
Although MariaDB is different from MySQL, when we use it, we also use the same mysqld command. Similar to the MySQL version check command, we also use the mysqld -V
command to see if we have received the latest MariaDB version.
So my VPS has the latest MariaDB version 10.5.4 installed.
Summary
hrough this article, you have learned how to quickly convert Mysql to MariaDB on DirectAdmin as well as the directory containing the databases that were dumped during the installation of the new MariaDB. Hope this article will be of great help to you.
Wishing you success.
If you need assistance, you can contact support in the ways below:
- Hotline 247: 028 888 24768 (Ext 0)
- Ticket/Email: You use the email to register for the service and send it directly to: support@azdigi.com