The database connection depends on several things:
- If server address is a host name (rather than an IP-address) then the name needs to be correct (and your web server needs to be able to resolve the address, i.e. talk to a DNS server and get a correct response).
- The web server needs to be able to contact the database server.
- The database name needs to be correct
- The database user-ID needs to be correct
- The password needs to be correct
- The database user account needs to have enough capabilities to use the database
Note that with many weg hosting companies your domain name, database name and user-ID are somewhat similar, but often not exactly the same. Pay attention to dots, underscores, hyphens, lowercase/UPPERCASE, etc.
If you get stuck: contact the support line of your hosting company. They deal with this kind of stuff every day and know how these things are handled in their garden.