This happened to me in a minimalist Alpine Linux container. You have to delete or comment out skip-networking in the file /etc/my.cnf.d/mariadb-server.cnf
skip-networking
/etc/my.cnf.d/mariadb-server.cnf