and the mysql setup (MySQL or Mariadb) will define the location of the actual files the mysql server serves, the default for both MySQL and Mariadb is /var/lib/mysql, so does /var/lib/mysql/emoncms exist? (use sudo when searching for it).
the “nature” of the error message would (to me) suggest that file cannot be found, I would expect different messages if the username or password were incorrect, likewise if the server address or port were incorrect, but I could be wrong (would that expectation be too logical?). So is the file name and permissions correct? Are you able to log in to emoncms? That should theoretically use all the same settings, if one works so should the other.
see emoncms/phpmqtt_input.php at master · emoncms/emoncms · GitHub
and emoncms/index.php at master · emoncms/emoncms · GitHub they are the same command
The “Cannot connect to MYSQL database:” is the logging prefix added by emoncms and the “No such file or directory” appears to be the error returned by mysql.