If you followed DirectAdmin's tutorial on how to upgrade your MariaDB database from version 5.5 to 10.0 here and stumbled upon this error:
error: %pre(MariaDB-server-10.4.18-1.el7.centos.x86_64) scriptlet failed, exit status 1
error: MariaDB-server-10.4.18-1.el7.centos.x86_64: install failed
Here's the solution:
First, ensure that your DirectAdmin server does not have CloudLinux's MySQL Governor. Otherwise, follow the steps on how to upgrade your MySQL/MariaDB database using the MySQL Governor method.
Step 1: Backup
Backup your database including system databases. This is extremely important so in the event of unforeseen problems, you can always restore them.
Here's how you can perform a complete backup of your databases.
$ mkdir -p ~/mysqlbkp
$ service mysql restart --skip-networking --skip-grant-tables
$ mysql_upgrade
$ mysqldump --all-databases --routines --triggers > ~/mysqlbkp/dbcopy.sql
$ service mysql stop
$ cp -r /var/lib/mysql/mysql ~/mysqlbkp/
$ service mysql start
Step 2: Prepare Upgrade
Enter the following in your command line:
$ /usr/share/lve/dbgovernor/mysqlgovernor.py --mysql-version=MYSQL_VERSION
Where MYSQL_VERSION is the MySQL/MariaDB Version you wish to upgrade to. Check the table below for the keyword:
mysql51 | MySQL v5.1 |
mysql55 | MySQL v5.5 |
mysql56 | MySQL v5.6 |
mysql57 | MySQL v5.7 |
mysql80 | MySQL v8.0 [requires MySQL Governor 1.2-37+; database packages available in beta only, so use --install-beta flag instead of --install] |
mariadb55 | MariaDB v5.5 |
mariadb100 | MariaDB v10.0 |
mariadb101 | MariaDB v10.1 |
mariadb102 | MariaDB v 10.2 |
mariadb103 | MariaDB v 10.3 [requires MySQL Governor 1.2-36+; for cPanel - MySQL Governor 1.2-41+] |
mariadb104 | MariaDB v 10.4 [requires MySQL Governor 1.2-53+] |
percona56 | Percona Server v 5.6 |
Eg: If you wish to upgrade to MariaDB 10.0, the command should be:
/usr/share/lve/dbgovernor/mysqlgovernor.py --mysql-version=mariadb100
Step 3: Install
Install the update:
/usr/share/lve/dbgovernor/mysqlgovernor.py --install
IMPORTANT: Ensure you your backup in Step 1 is successful.
The installation will be handled by the script and pretty straight-forward. You will see that the upgrade is successful when you see:
Installation of mysql for db_governor completed
Step 4: Verify
Verify the version installed by running:
$ mysql -V
And you should be able to see:
mysql Ver 15.1 Distrib 10.0.38-MariaDB, for Linux (x86_64) using readline 5.1