Procedure for updating Mariadb

Is there a procedure in the libreNMS doc’s on how to update my Mariadb database. It stopped working over the weekend and it’s telling me my database is an unsupported version. I’m a network guy and don’t mess around a whole lot with Linux and databases so be gentle. I just performed sqldump on all my db’s and put them in a directory I created under the “mysql” folder.

Hello

It’s out of scope for librenms to provide guides,
but I’d suggest you update your OS to a newer release instead if you can, it’s often as easy as upgrading the database alone.
If not, you didn’t mention what dist you use, but Google “upgrade mariadb centos7” or so, since it will differ between dists.

Just went through the same thing. You will need to first update MariaDB, then you’ll have to manually fix some of the database, then I also had to rebuild one of the port tables. Everything I needed was here in this forum so just search for the details. For example, CentOS7 maxes out at MariaDB 5 so I had to uninstall server/client/libs and then add the proper new repo and install MariaDB 10.5 from there. When thats done, run “validate.php” and it will tell you database has issues, so run “lnms migrate --pretend” I think it was. Then I fixed those issues manually because it was unable to do so, eventually you can get a clean result from “validate.php”.

Depending on the version you have installed at the moment there are no manual steps needed inside the db. E.g. tables

Just follow the instructions of upgrading mariadb described by the mariadb docs itself.

Thank you, yeah I forgot to mention my dist. which is Ubuntu 18.0.4.

I would still recommend upgrade your entire dist instead. 18.04 is quite old now.

https://www.cyberciti.biz/faq/upgrade-ubuntu-18-04-to-20-04-lts-using-command-line/

Hi Arlen,

I’ve followed this procedure and it worked like a charm.

I was running MariaDB5.5 on CentOS 7
Good luck
Javier

Upgrading MariaDB 5.5 to MariaDB 10.5.
Please follow the below link for upgrading. Take a backup of database before performing it.

https://mariadb.com/docs/deploy/upgrade-community-server-cs105-centos7/

This worked for me. If you encounter any error while mariadb-upgrade like below then login to DB as root and perform below:

ERROR: SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘port_groups’ already exists

Run: DROP table port_groups; and ./lnms migrate

LibreNMS is ready to operate now.

I got everything upgraded and I’m running ./validate.php and I get the error you were referring to, however I’m unable to drop the table, instead I get this error:

MariaDB [librenms]> DROP table port_groups;
ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails
MariaDB [librenms]>

Do this before:

SET FOREIGN_KEY_CHECKS=0;

1 Like

Thank you sir, that fixed my issue, I was able to finish my migration.

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