In the posting with debug, 'Oracle Linux with MySQL 5.7.21'.
In this last posting you say 'Database version: 8.0.15-commercial'
In the error to one of those php scripts ... note is mentions 'engine' ...
Notice: Undefined index: engine in my_moodle_path/lib/dml/mysqli_native_moodle_database.php on line 173
Could be MySQL ... version 8 of MySQL is barely out of shrink wrap so to speak (GA release is fairly new).
Using client from web server, connect to DB server.
on 5.7/.8 default engine now InnoDB if my.cnf set as per docs for Moodle and full unicode support.
You may have gotten on the 'bleeding edge'. :|