Yes, you can use MariaDB. MariaDB is a drop-in replacement for MYSQL so compatibility is not an issue. WordPress even lists MariaDB as an option within the requirements on their website:
We recommend servers running version 7.2 or greater of PHP and MySQL version 5.6 OR MariaDB version 10.0 or greater.
Here is a resource from MariaDB on this topic https://mariadb.com/resources/blog/how-install-and-run-wordpress-mariadb.