Running MariaDB on a device with 128MB RAM - Possible?

Hi all,
I recently upgraded from 15.05 to 18.06, I have been running mysql on 15.05 without problems.

In 18.06, MariaDB has replaced MySQL, but with or without whatever config tweaks applied, it OOM's on DB creation:

# mysql_install_db -v --force
Installing MariaDB/MySQL system tables in '/srv/mysql' ...
2020-01-03 14:48:31 2000956684 [Note] /usr/bin/mysqld (mysqld 10.1.41-MariaDB) starting as process 13146 ...
2020-01-03 14:48:31 2000956684 [ERROR] mysqld: Out of memory (Needed 130760704 bytes)
2020-01-03 14:48:31 2000956684 [ERROR] mysqld: Out of memory (Needed 98058240 bytes)
2020-01-03 14:48:31 2000956684 [ERROR] mysqld: Out of memory (Needed 73531392 bytes)
OK
Filling help tables...
2020-01-03 14:48:31 2000858380 [Note] /usr/bin/mysqld (mysqld 10.1.41-MariaDB) starting as process 13154 ...
2020-01-03 14:48:31 2000858380 [ERROR] mysqld: Out of memory (Needed 130760704 bytes)
2020-01-03 14:48:31 2000858380 [ERROR] mysqld: Out of memory (Needed 98058240 bytes)
2020-01-03 14:48:31 2000858380 [ERROR] mysqld: Out of memory (Needed 73531392 bytes)
OK
Creating OpenGIS required SP-s...
2020-01-03 14:48:33 2012908812 [Note] /usr/bin/mysqld (mysqld 10.1.41-MariaDB) starting as process 13161 ...
2020-01-03 14:48:33 2012908812 [ERROR] mysqld: Out of memory (Needed 130760704 bytes)
2020-01-03 14:48:33 2012908812 [ERROR] mysqld: Out of memory (Needed 98058240 bytes)
2020-01-03 14:48:33 2012908812 [ERROR] mysqld: Out of memory (Needed 73531392 bytes)
OK

(using MyISAM instead of InnoDB here...)

Any thoughts highly appreciated!

Hello, if there's no way to change the config so that it needs less RAM maybe create a Linux swap file somewhere on a file system (USB HDD or something). That should get mysql_install_db going, so that it can finish. Hopefully the server doesn't need to swap once it's running (or at least not that much).

Thanks! Will try that.

In my experience MySQL is still a better solution than MariaDB. I have not dug through all the history and change logs, but on a limited RAM system I have always seen better performance with MySQL. That's just my opinion, as mentioned try enabling some swap to let the operation finish and see how things go. For me I was able to get MariaDB running with swap on a USB drive, but the performance was horribly slow and for basic database usage that had worked fine with MySQL 3 days of fighting just to get that far was enough for me.

You can still build MySQL on modern OpenWRT, you just need to port the make file and compile it yourself.

thanks for the info! question is, would there be support from openwrt to include mysql in the package repo (again)?

In case, you succesfully installed mysql on 19.0.x (trunk preferred), do you mind to share the Makefile ?

Also keen to see an updated makefile - are you using one you could share?

FYI - when I tried to compile against trunk using the last makefile I have, I get this error:

configure: error: Could not find system readline or libedit libraries
	      Use --with-readline or --with-libedit to use the bundled
	      versions of libedit or readline
Makefile:185: recipe for target '/build_dir/target-mipsel_24kc_musl/mysql-5.1.73/.configured_68b329da9893e34099c7d8ad5cb9c940' failed

why you need MySQL on a router?

Do you know https://www.sqlite.org/index.html with very small footprint.

It's not a router any more. Now it's a computer inside a router's box, that can be used as a router, as a server, or ...

SQLite does not have a network endpoint.