Where does Confluence store the database password?
Database connected via JDBC URL
If your Confluence instance connects directly via JDBC, then your password will be stored inside the <CONFLUENCE_HOME>/confluence.cfg.xml file.
For example:
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">confluencepass</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost/confluence?autoReconnect=true</property>
<property name="hibernate.connection.username">confluencedbuser</property>
<property name="hibernate.database.lower_non_ascii_supported">true</property>
<property name="hibernate.dialect">com.atlassian.hibernate.dialect.MySQLDialect</property>
Change the "hibernate.connection.password" property to the correct value (in the example above replace "confluencepass" with the new password).
Database connected via JNDI datasource
If your Confluence instance connects via JNDI datasource, then you'll see in the confluence.cfg.xml file something like the following:
<property name="hibernate.setup">true</property>
<property name="hibernate.dialect">com.atlassian.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.datasource">java:comp/env/jdbc/confluence</property>
That is, the property "hibernate.connection.datasource" is defined. If so, your password is defined within your datasource. Each application server stores its information differently, but with Tomcat, check your <CONFLUENCE_INSTALL>/conf/server.xml file for the following:
<Resource name="jdbc/confluence" auth="Container" type="javax.sql.DataSource"
username="<database-user>"
password="<password>"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://<host>:3306/<database-name>?useUnicode=true&characterEncoding=utf8"
maxTotal="60"
maxIdle="20"
defaultTransactionIsolation="READ_COMMITTED"
validationQuery="Select 1”/>
Change the value for the "password" attribute to the new desired value.
Please note that any changes made to the confluence.cfg.xml or server.xml file will require a restart of Confluence to take effect.