Changing Your Database Username

The database username is defined by the lcp-secret-database-user secret and can be changed at any time. When this value is changed, a user with the new credentials is created in your database, and the previous username is removed when the service restarts.

However, before changing the secret’s value, you can add the current username to a list of retained users using the LCP_DATABASE_USER_WHITELIST variable. User credentials added in this way are retained and remain associated with your database even after the service is updated with a new secret value.

Warning

Updating your database username requires a period of downtime for you to restore a backup to your database service, and then restart all of your services. Plan ahead to make time for this before rotating your database password.

Keep in mind that changing the username can affect other services connected to the database, such as the liferay and backup services. These services must also restart when the database username is changed to continue working.

note

If no database username secret exists, then your Project service uses the LCP_MASTER_USER_NAME variable. This variable is defined in the LCP.json file and uses dxpcloud as its default value.

Creating a Backup

If you are changing the password for a production environment, you must ensure you have an up-to-date backup so you can restore it after the update.

To create a backup for any environment, click Backups from the menu on the left:

Navigate to your chosen environment's Backups page.

Then, click Backup Now on the Backups page:

Click Backup Now to create a new backup.

Retaining Database Usernames

Follow these steps to retain the current username by adding it to the list of retained users:

  1. Go to the dedicated database service page in the desired Project environment.

  2. Click on the Environment Variables tab.

  3. Enter LCP_DATABASE_USER_WHITELIST under Regular variables, and enter the username you want to retain as its value. You can enter multiple usernames by separating with with a space and/or comma.

  4. Click on Save Changes.

Once saved, the database service automatically restarts and adds the current credentials to the list of retained users. After the service has finished restarting, proceed to change the lcp-secret-database-user secret.

How to Change Your Database Username

Follow these steps to change your database username:

  1. Go to the desired Project environment, and click on Settings in the environment menu.

  2. In the Secrets section, click on the Actions button for lcp-secret-database-user, and select Edit.

  3. In the Value section, click on Show to reveal and enable editing for the secret’s value. Then, set a new value.

    You can optionally select which users can view the secret value, as well as which services use the secret.

  4. Use the Publish secret checkboxes to acknowledge the impact of your changes on connected services.

  5. Click on Publish Changes.

Once published, all connected services restart and stop receiving requests for some minutes. They may also behave differently depending on the secret’s usage. When the service starts up, the environment variables are read and the database user is updated.

Capabilities

Product

Contact Us

Connect

Powered by Liferay
© 2024 Liferay Inc. All Rights Reserved • Privacy Policy