• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Contribution TUTORIAL: downgrade MariaDB 10.2 to MariaDB 10.1

B4c4rd1

Regular Pleskian
Hello everybody,

I introduce you here a tutorial on how to downgrade MariaDB on a livesystem.

The tutorial will not be perfect, but they are all cordially invited to improve it.

Tested with Ubuntu 16.04 and Plesk Onyx 17

If you have added MariaDB via APT, you must delete the source to MariaDB 10.2:
Code:
add-apt-repository --remove 'deb [arch=amd64,i386,ppc64el] http://ftp.hosteurope.de/mirror/mariadb.org/repo/10.2/ubuntu xenial main'

Now you add the MariaDB 10.1 APT source:
Code:
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://ftp.hosteurope.de/mirror/mariadb.org/repo/10.1/ubuntu xenial main'

Update APT:
Code:
apt update

Now create a database Backup:
Code:
MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -u admin --add-drop-table --routines --events --all-databases --force > data-for-downgrade.sql
MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin --execute="SET GLOBAL innodb_fast_shutdown=0"

Now stop mysql
Code:
service mysql stop

Create a backup from your MySQL lib (If something goes wrong and you have to reinstall MariaDB 10.2.):
Code:
mv /var/lib/mysql{,.bak}

Now install MariaDB 10.1 (If an error occurs, run the following command again).
Please confirm the root password without input with enter:
Code:
apt-get install --purge mariadb-client-10.2- mariadb-client-core-10.2- mariadb-server-10.2- mariadb-server-core-10.2- mariadb-client-10.1 mariadb-client-core-10.1 mariadb-server-10.1 mariadb-server-core-10.1 libmariadbclient18 libjemalloc1 libmysqlclient18

Restore backup (Enter the previously entered MySQL password. In this case simply press enter):
Code:
mysql -u root -p --force < data-for-downgrade.sql

Login to MySQL (Enter the previously entered MySQL password. In this case simply press enter):
Code:
mysql -uroot -p mysql

Check Users:
Code:
select host, user, password from mysql.user;

Output:
Code:
+-----------+------------------+-------------------------------------------+
| host      | user             | password                                  |
+-----------+------------------+-------------------------------------------+
| localhost | pma_XXX| XXX |
| localhost | apsc             | XXX |
| localhost | roundcube        | XXX |
| localhost | debian-sys-maint | XXX |
| localhost | admin            | XXX |
+-----------+------------------+-------------------------------------------+

If you see your old users, then flush privileges:
Code:
FLUSH PRIVILEGES;
quit;

All done!

Please test this before in a VM with your configuration. I hope this will help some.
 
I will do that. Thanks for your message :)

I have done more tests. After the downgrade, a mysql error can occur if the variable binlog format was not set to MIXED in my.cnf. Since the default is set to STATEMENT at mariaDB 10.1.
 
Back
Top