Database access
Direct access to an environment’s database is limited, but users can view data in a read-only phpMyAdmin console session or interact with the databases on WPVIP through WP-CLI commands run via VIP-CLI.
Copies of database backups can also be downloaded from an application’s VIP Dashboard or with VIP-CLI.
phpMyAdmin
Users with an Org admin role or an App admin role can access a read-only phpMyAdmin console with the VIP-CLI command vip db phpmyadmin
.
The vip db phpmyadmin
command opens a phpMyAdmin console for an environment’s database in the user’s default browser. The phpMyAdmin session will persist for 6 hours. To begin a new session run the vip db phpmyadmin
command again.
Note
For sites behind a reverse proxy configuration, all request paths that begin with [PROXIED_DOMAIN]/.wpvip/pma
must be configured to forward to VIP in order to access the phpMyAdmin console.
Refer to phpMyAdmin’s documentation for additional guidance on performing read-only actions in the console.
WP-CLI
WP-CLI commands can be run in the command line using the VIP-CLI vip wp
command. Most WP-CLI wp db *
commands are disallowed, but wp db query
is allowed and defaults to read-only. For write operations, wp db query
must be passed with --read-write
.
The user will be prompted to confirm the action before a command with --read-write
is run against the database. To skip the confirmation prompt, include the --skip-confirm
in the command.
As an alternative, a custom WP-CLI command could run a function that leverages $wpdb->query()
.
Database queries that include DROP
, TRUNCATE
or CREATE
cannot be executed.
Last updated: November 11, 2024