Mysql service keeps stopping

Yes, swap partition or swap file. On a running system it is often easier to add a swap file if you have no free partitions.

Linux is supposed to use available RAM as cache. I’d speculate that usage shows up as ‘root’ but I have no proof for that.

Does top/htop sorted by memory usage show the same pattern?

It would be quite a coincidence if that were not the case: about all software is replaced of course. I was thinking of maybe changed defaults for MariaDB, but I didn’t compare the configuration files. Maybe someone else has an idea?