I may have missed it but have you tried the following without specifying the port/socket:
...
'dbtype' => 'mysql',
'dbhost' => 'localhost',
'dbname' => 'nextcloud',
'dbuser' => 'root',
'dbpassword' => '',
'dbtableprefix' => 'oc_',
...
Looking at the port you are using, it’s the standard one anyway and you are on localhost, so it shouldn’t be necessary to specify the port.