Most CMSs such as WordPress or Joomla store the database details in their default configuration files.
The WordPress configuration file is called wp-config.php and can be found in your website root folder. This is usually called public_html or httpdocs however, if your website is located in a subfolder (http://domain.tld/wordpress for example) then the root folder for the website will be /public_html/wordpress or /httpdocs/wordpress.
Open the wp-config.php to check or alter the database connection details, they look like this:
/** MySQL database username */
/** MySQL database password */
/** MySQL hostname */