Skip to content

Access MySQL via SSH

1. SSH into your server

SSH into your server to access the wpcontroller command line interface (CLI).

2. Find your site ID

Your site must be started to access the MySQL shell.

$ sudo wpcontroller site list

SITE ID                    DOMAIN                CURRENT STATE    TARGET STATE     TASK             CREATED             
-------------------------  --------------------  ---------------  ---------------  ---------------  --------------------
site_cd9el81hvg0edvd88arg  example.com           Started          Started          None             21 Oct 22 18:53 UTC 

3. Launch the MySQL shell

$ sudo wpcontroller site shell site_cd9el81hvg0edvd88arg mysql

4. Run SQL queries

mysql> SHOW TABLES;
+-----------------------+
| Tables_in_wordpress   |
+-----------------------+
| wp_commentmeta        |
| wp_comments           |
| wp_links              |
| wp_options            |
| wp_postmeta           |
| wp_posts              |
| wp_term_relationships |
| wp_term_taxonomy      |
| wp_termmeta           |
| wp_terms              |
| wp_usermeta           |
| wp_users              |
+-----------------------+
12 rows in set (0.00 sec)