There are several ways to get your database username and password (e.g. MariaDB MySQL service). You can obtain the credentials through platform cli or from your app containers.
After you ssh into app container, utilize the following command:
echo $PLATFORM_RELATIONSHIPS | base64 -d | jq .
From localhost:
platform relationships
The password value changes automatically over time, to avoid downtime its value has to be read dynamically by your app. Globally speaking, having passwords hard-coded into your codebase can cause security issues and should be avoided.