The config file may not be correct. These are the relevant bits of my (working) config.php...
$CFG->dbtype = 'mariadb'; // 'pgsql', 'mariadb', 'mysqli', 'auroramysql', 'sqlsrv' or 'oci'$CFG->dblibrary = 'native'; // 'native' only at the moment$CFG->dbhost = 'mysql'; // eg 'localhost' or 'db.isp.com' or IP$CFG->dbname = 'moodle44'; // database name, eg moodle$CFG->dbuser = 'root'; // your database username$CFG->dbpass = 'purple'; // your database password$CFG->prefix = 'mdl_'; // prefix to use for all table names$CFG->wwwroot = 'http://ubuntu2.local:8082';$CFG->dataroot = '/app/moodledata';Before anybody says anything - this is a completely local install in a test site, so the passwords are not intended to protect anything "real".
The ubuntu2.local is the hostname of the server on my local network so that I can access Moodle from other machines. I can't see why 'localhost' wouldn't work if you don't need that.