In some cases, when MariaDB is installed on Ubuntu and, in particular, on virtual machines, the MariaDB server does not recognize the configuration file my.cnf, which is included in the path by default:
/etc/mysql/my.cnf
If this is the case the file that you have to edit is the "50-server.cnf" that is in the path:
/etc/mysql/mariadb.conf.d/50-server.cnf