How can I connect to a website's database?
There is more than one means of connecting to a database.
Adminer is a web based database administration tool written in PHP. It is included by default for all website in your Private Cloud and can be accessed either from Control HQ or in your Hub.
In either case, navigate to the management page for a particular site, go to Developer > Database Manager to access it.
To manage the database using the wordpress cli, first you need to SSH to your website environment:
Once you are connected to your website environment you can connect to the database with the MySql client by executing the command from the command line.
Once the MySql client is connected to the database, you have the full power of MySql commands available to you.
Examples:
The most convenient way to access and manage your database is using a desktop app via SSH. We recommend TablePlus, which supports macOS, Windows and Linux. TablePlus offers a free trial which is limited to 2 opened tabs and 2 opened windows at a time, but you can upgrade to a paid license to unlock all functionality.
In order to use a desktop app such as TablePlus, you will need the following:
SSH credentials
Database credentials
Both which are available to you in the control panel.
Using The Database Manager in Control HQ or Your Hub
Adminer is a web based database administration tool written in PHP. It is included by default for all website in your Private Cloud and can be accessed either from Control HQ or in your Hub.
In either case, navigate to the management page for a particular site, go to Developer > Database Manager to access it.
Using the MySQL client
To manage the database using the wordpress cli, first you need to SSH to your website environment:
ssh user@examplewebsite.com
Once you are connected to your website environment you can connect to the database with the MySql client by executing the command from the command line.
mysql
Once the MySql client is connected to the database, you have the full power of MySql commands available to you.
Examples:
SELECT * FROM wp_usermeta WHERE meta_key = 'points' AND user_id = '1' SELECT * FROM posts WHERE post_title LIKE '%s'
Using a Desktop App
The most convenient way to access and manage your database is using a desktop app via SSH. We recommend TablePlus, which supports macOS, Windows and Linux. TablePlus offers a free trial which is limited to 2 opened tabs and 2 opened windows at a time, but you can upgrade to a paid license to unlock all functionality.
In order to use a desktop app such as TablePlus, you will need the following:
SSH credentials
Database credentials
Both which are available to you in the control panel.
Updated on: 27/02/2024
Thank you!