Changing Your Database Password
Changing the database password for your database
service also affects the other services that must connect to the database.
Updating your database password 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.
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:
Then, click Backup Now on the Backups page:
Changing the Database Password
Change your database password using your chosen environment’s secrets, after you’ve created a backup.
-
Navigate to your chosen environment.
-
Click Settings from the menu on the left.
-
Click the Secrets tab.
-
Click the
lcp-secret-database-password
secret from the list. -
Click Edit at the top of the screen.
-
In the Value section, click Show beside the value to reveal the secret and enable editing.
-
Edit the secret value.
-
Scroll down and check all of the boxes acknowledging the effects of changing the value of the secret.
-
Click Publish Changes.
The services restart and the database user is updated with the new password. While the services are restarting, they do not receive requests.
If your database service is not updated to version 5.1.2+, the password can only be updated after deleting and redeploying the service. Continue reading to complete the process for these versions.
Additional Required Steps (Versions Before 5.1.2)
The database password is still changed directly using your chosen environment’s secrets prior to version 5.1.2. However, you must follow additional steps to ensure that your services update correctly with the new value.
After you’ve updated the secret value, follow these steps to complete the process.
-
Return to your environment’s Services page.
-
From the Actions menu for the
database
service, click Delete Service. -
Open a command prompt within your local clone of the repository.
-
Deploy the
database
service to your environment using the command-line interface:cd database
lcp deploy
-
If you are not already logged in, enter
y
at the prompt and authenticate with your browser. -
When prompted, enter the number corresponding to your environment:
# Project Status 1 lfrlearn-infra Ready 2 lfrlearn-uat Ready 3 lfrlearn-dev Ready 4 lfrlearn-prd Ready ? Type a number (#) or project name: 2
The database service starts up using the updated password. The
liferay
andbackup
services restart to reconnect to the database service with the correct password, as well. -
If you prepared a backup, then navigate to your chosen environment’s Backups page, and restore the backup.
Your database
service is now updated with a new password, and your other services are synchronized to connect to it properly.