MariaDB version not recognised

As discussed in comments, the problem was a missing prce2 package which meant preg_match(), used by $wpdb->db_version() to parse the MySQL version number out of SELECT VERSION(), didn’t work. Solved by

sudo yum install pcre2

tech