Using the MySQL Client¶
Viewing data in the database is sometimes necessary to troubleshoot an issue with your application or do custom development. In order to access the database, you must use a built-in MySQL client to interface directly with the database. This feature is available in up-to-date versions of DXP Cloud, and can be accessed in a few short steps.
Only DXP Cloud users with Admin and Contributor privileges can make use of the MySQL client.
Before you can use the MySQL Client through the Liferay service, you must have your services upgraded to at least the following supported image versions:
Minimum Supported Image Version
DXP (using 7.0)
DXP (using 7.1)
DXP (using 7.2)
Upgrading your database image to a version that supports MySQL client will initialize the read-only user for the database. If you do not set a password for this user before upgrading, then it will use a default, and it cannot be changed later. See Changing the Read-Only Database Password for more information.
Accessing the MySQL Client¶
Log into the DXP Cloud console.
Navigate to the correct environment, and click Services:
Click on the liferay service.
Click on the Shell tab:
mysqlinto the shell on this screen. This logs you into the MySQL client, where you can perform any read-only queries. For example, you can see all the tables by executing
Please refer to the official MySQL Client documentation to see all the commands available.
Logging in with Read and Write Privileges¶
The default user can only perform read queries on the database, and cannot manipulate data. This prevents accidental modifications that may corrupt data for your services.
However, if it is critical to be able to manipulate data in the database, you can login using the database credentials by typing this command into the shell (instead of only typing
mysql -u <user_name> -p <database_name>
You can find the database name, user name, and password on your
Changing the Read-Only Database Password¶
If you have not yet deployed the database service on a supported version, then you can set your own password for the default user by setting the
LCP_DATABASE_READONLY_USER_PASSWORD environment variable in the database service’s
If you have already deployed your database service using a version that supports the MySQL client, then the default user will already be initialized with a default password. This password cannot be changed later, so you can only add the
LCP_DATABASE_READONLY_USER_PASSWORD environment variable before you deploy the database service (either for the first time, or updating from an older image version than the above). Otherwise, you must use the default, generated password.
Then, update to the appropriate Docker image versions (or newer) and re-deploy the services so that the MySQL client is available for use.
If you set your own password for the default user with
LCP_DATABASE_READONLY_USER_PASSWORD, then add the same environment variable to your
liferay service. Otherwise, do not add this variable, so that the service uses the default password.
You can add this variable from within the Environment Variables tab: