The snap doesn't support setting the database port:
2 roaksoax@rivals:~/project/maas$ sudo maas config --help
usage: maas config [-h] [--show] [--show-database-password] [--show-secret]
[--mode {all,region+rack,region,rack,none}]
[--maas-url MAAS_URL] [--database-host DATABASE_HOST]
[--database-name DATABASE_NAME]
[--database-user DATABASE_USER]
[--database-pass DATABASE_PASS] [--secret SECRET] [--force]
[--parsable]
View or change controller configuration.
optional arguments:
-h, --help show this help message and exit
--show Show the current configuration. Default when no
parameters are provided.
--show-database-password
Show the hidden database password.
--show-secret Show the hidden secret.
--mode {all,region+rack,region,rack,none}
Set the mode of the MAAS snap (all, region+rack,
region, rack, or none).
--maas-url MAAS_URL URL that MAAS should use for communicate from the
nodes to MAAS and other controllers of MAAS.
--database-host DATABASE_HOST
Hostname or IP address that should be used to
communicate to the database. Only used when in
'region+rack' or 'region' mode.
--database-name DATABASE_NAME
Database name for MAAS to use. Only used when in
'region+rack' or 'region' mode.
--database-user DATABASE_USER
Database username to authenticate to the database.
Only used when in 'region+rack' or 'region' mode.
--database-pass DATABASE_PASS
Database password to authenticate to the database.
Only used when in 'region+rack' or 'region' mode.
--secret SECRET Secret token required for the rack controller to talk
to the region controller(s). Only used when in 'rack'
mode.
--force Force leaving 'all' mode and cause loss of database.
--parsable Output the current configuration in a parsable format.