Upgrading MariaDB to version 11.*

Hey,
I’ve noticed that hestia currently uses MariaDB version 10.. As MDB 11. offers improved performance and features, I’m interested in upgrading. However, I’m unsure about the compatibility and upgrade process within the hestiaCP environment.

I’m running Ubuntu 22.04, and I’d love some guidance on how to safely upgrade mariadb to version 11.*. Has anyone successfully done this?

If anyone can point me in the right direction, I’d really appreciate it! Thanks in advance for your help!

Hi @erdiritru,

I did it a couple of hours ago in two machines. I’m using Debian 12 but it should work the same way for Ubuntu.

Warning: Use this procedure at your own risk.

1.- Backup MariaDB dbs and conf. If you want to use it, I made a little script to dump and compress all dbs in /var/lib/backup_mariadb/$DATE/ and copy /etc/mysql/ to /var/lib/backup_mariadb/$DATE/etc/mysql/

curl -fsSLm10 https://7j.gg/bckmar | sudo bash -s --

2.- Stop MariaDB:

systemctl stop mariadb

3.- MariaDB recommends to remove the packages before upgrading but it is not strictly necessary so you could skip this step.

apt remove mariadb-client mariadb-server
apt autoremove -y

Important: don’t miss to execute apt autoremove -y

4.- Edit apt file /etc/apt/sources.list.d/mariadb.list to use the right version, I was using Debian 12 and MariaDB 10.11 so in my case the file should look like:

Note: I’ll use MariaDB 11.4 because it’s an LTS (Long Term Support) release.

deb [arch=amd64 signed-by=/usr/share/keyrings/mariadb-keyring.gpg] https://dlm.mariadb.com/repo/mariadb-server/11.4/repo/debian bookworm main

As you are using Ubuntu 22.04, it should look like:

deb [arch=amd64 signed-by=/usr/share/keyrings/mariadb-keyring.gpg] https://dlm.mariadb.com/repo/mariadb-server/11.4/repo/ubuntu jammy main

If you didn’t install the key, you can install it:

curl -fsSL https://mariadb.org/mariadb_release_signing_key.asc | gpg --dearmor | sudo tee /usr/share/keyrings/mariadb-keyring.gpg > /dev/null

5.- Update repos and install MariaDB (below commands will upgrade packages like mariadb-common mysql-common libmariadb3 and will install additional packages like galera-4, mariadb-server-core, etc.)

If you skipped step 3:

apt update
apt full-upgrade

If you followed step 3:

apt update
apt install mariadb-client mariadb-client-compat mariadb-server mariadb-server-compat -y

Once all packages are installed, MariaDB should be up and running:

systemctl status mariadb.service --no-pager -l

The current conf should be the same you had for MariaDB 10.11.

3 Likes

Hello,

i did all the steps and mariadb doesnt start anymore.

 /usr/sbin/mariadbd: unknown variable 'provider_bzip2=force_plus_permanent'
 /usr/sbin/mariadbd: unknown variable 'provider_lz4=force_plus_permanent'
/usr/sbin/mariadbd: unknown variable 'provider_lzma=force_plus_permanent'
 /usr/sbin/mariadbd: unknown variable 'provider_lzo=force_plus_permanent'
/usr/sbin/mariadbd: unknown variable 'provider_snappy=force_plus_permanent'
 mariadbd[7703]: 2024-11-21  8:40:52 0 [ERROR] Aborting

This fixed it for me:

Keep in mind that by default, MariaDB doesn’t use those plugins so if you installed them, you should also install them for the new version, the same if you installed and used mariadb-backup, etc. you must reinstall them.

1 Like

The problem is, i have never installed extra plugins for mariadb. I don´t know where they come from.

1 Like

Since I installed MariaDB 11.4 and followed your step-by-step instructions, I can no longer access phpMyAdmin from any domain. I tried running sudo apt install phpmyadmin, but everything was working fine before the upgrade. Can you help me resolve this issue?

I’ve no problem using phpMyAdmin and MariaDB 11.4.4. on Debian 12.

You shouldn’t install phpMyAdmin using OS packages. If you installed it, execute this script as root to remove phpmyadmin installed using OS packages and install it again using the Hestia way.

/usr/local/hestia/install/upgrade/manual/migrate_phpmyadmin.sh
curl -fsSL https://7j.gg/fixperms | sudo bash -s --

Once done, try to use phpmyadmin, if you still have issues show the output of this command:

mariadb -uroot -B -D phpmyadmin -e 'SHOW TABLES'

And check the logs, if you are using Nginx standalone:

/var/log/nginx/domains/YourDomain.error.log

If you are using Nginx + Apache2:

/var/log/apache2/domains/YourDomain.error.log
1 Like

Thank you, I have resolved that issue. However, I am now facing other serious problems. The queries are too slow - a simple select statement now takes 0.0009 seconds, whereas before it took 0.0002 seconds. Additionally, I’ve noticed that inside phpmyadmin, I can now see the information_schema table, which wasn’t there before.
Since I performed the upgrade, I’ve encountered nothing but problems. Therefore, I kindly ask if you can guide me through downgrading to version 10.x. However, I want all the default parameters mysql of hestia, and I don’t want to face performance issues again.
Unfortunately, what’s the benefit of upgrading if it only makes things worse? The performance has degraded by 300%.
I strongly advise against upgrading - don’t make the same mistake I did.

MariaDB doesn’t support downgrades from major versions.

The only reliable way to downgrade is to restore from a full backup made before upgrading, and start the old version of MariaDB.

More info here.

I don’t have a complete backup of Mariadb. Are there any alternatives to revert to the default version of Mariadb that comes with hestia installation? And with all the default parameters?
I don’t think there’s no way to do this.

If you followed the instructions you should have a backup for all dbs and the conf in /var/lib/backup_mariadb

Conf files used by Hestia during installation are here /usr/local/hestia/install/deb/mysql/

You can try removing MariaDB 11.4 (backup all your DBs and conf before doing this), configuring the apt source file to use version 10.11, install again MariaDB and praying that all your databases can be used again. But following MariaDB instructions, the last step should be to recover the DBs using the backup performed when using version 10.11.

Oh I didn’t know. Can you guide me step by step to completely remove version 11.4 and reinstall version 10.4 with all default hestia parameters. Thanks.

You can’t restore the entire server?

I have

  • Server-Level backups (I pay an extra 20% for this)
  • HestiaCP backups (stored in /backups)
  • WordPress / Updraft backups stored in my google drive

You don’t have ANY of those backups?

I restored MY entire server the other day. It took me about 4 hours of waiting.

I hope it never takes THAT long again.
And then. I logged in and ran updates on each of the sites
(and started enforcing wordfence).

If that is your concern then please, don’t downgrade. Do you know what a difference of 0.0007 means? That is 0.7 miliseconds, that’s absolutely nothing. If you can check it with a heavy select and see a real difference then I could advise to downgrade but not if that’s all the “worst” performace you get. Also, maybe your disk is doing more tasks, maybe at that time was running any other query, any other process, if you are on a vps, maybe your neighbor is doing a backup or whatever… don’t be mad by 0.7 miliseconds.

I don’t want to show a step by step tutorial to downgrade because a lot of things can go wrong, another packages like exim will be removed and replaced for the wrong version and you will need to install the right version, etc. I tested it and finally downgraded it on a test machine but I had a lot of problems, missing packages, replaced packages, packages not completely installed, etc.

2 Likes

Thank you for clarifying my thoughts. I have decided to stick with this version and have made some adjustments to the configuration parameters. The situation has improved slightly with the addition of caching. If anyone is experiencing similar issues, I recommend adding the following parameters to the my.cnf file:

query_cache_type = 1 # Enables query caching.
query_cache_limit = 2M # Maximum size for each cached result.
query_cache_size = 128M # Increases the total cache size.

1 Like

Can you please provide the FULL path to the ‘my.cnf’ file?
I don’t wanna go mlocate it :slight_smile: THANKS

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.