Apparently, the newest setup of cPanel servers comes in with MySQL8 by default. i have tried migrating a customer but there are some database incompatibilities, therefore we just put up another box with AlmaLinux 8 and here are the steps for performing a MySQL swap to MariaDB:
Now, this works on brand new servers, where maybe you forgot to setup MariaDB right in the beginning as per the cPanel tutorial here. If you have databases/users on the server and you still wish to downgrade, make sure to back them up beforehand, as we’re removing the SQL Server and the data.
- Disable MySQL monitor in WHM >> Service Manager (we don’t want MySQL attempts to restart the service while we are working)
- i cannot live without this: dnf install bash-completion
- Stop MySQL: systemctl stop mysqld
- mv /var/lib/mysql /var/lib/mysql-old
- mv /etc/my.cnf /etc/my.cnf-old
- Remove the MySQL rpm’s: yum remove mysql-community-client-8.0.32-1.el8.x86_64 mysql-community-common-8.0.32-1.el8.x86_64 mysql-community-libs-8.0.32-1.el8.x86_64 mysql-community-server-8.0.32-1.el8.x86_64 mysql-community-icu-data-files-8.0.32-1.el8.x86_64 mysql80-community-release-el8-4.noarch mysql-community-client-plugins-8.0.32-1.el8.x86_64
- Add the MariaDB repo. i am adding the 10.3 – feel free to change for whatever version you need.
- cat >> /etc/yum.repos.d/mariadb.repo << EOF
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/rhel8-amd64
module_hotfixes=1
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF - Install the MariaDB Server and Client: dnf update && dnf install MariaDB-client.x86_64 MariaDB-common.x86_64 MariaDB-server.x86_64
- WHM >> SQL Services >> MySQL Root Password – > Change the MySQL root password
- Force cPanel/WHM upgrade: /scripts/upcp –force
- Enable the new MariaDB installation: systemctl enable mariadb.service
- Enable the MySQL monitor in WHM >> Service Manager
That’s it! Enjoy!