Plesk Database

The database is very important as it contains a lot of vital information for the website to work. By default Plesk disables direct access to the database for security reasons. However if you wish to access the database via the SSH environment, you can use the following syntax:

mysql -uadmin -p`cat /etc/psa/.psa.shadow` mysql

This will then provide you with the mysql cli interface where you can manipulate the database through commands:

mysql> show databases;

+-------------------------+
| Database                |
+-------------------------+
| information_schema      |
| apsc                    |
| horde                   |
| mysql                   |
| phpmyadmin_7kVKV5REScEj |
| psa                     |
| roundcubemail           |
| sitebuilder5            |
| wordpress_c             |
+-------------------------+
9 rows in set (0.00 sec)

We can also access the database itself with:

mysql> use wordpress_c;

Database changed

From here we can browse the database as well:

mysql> show tables;

+-----------------------+
| Tables_in_wordpress_c |
+-----------------------+
| wp_commentmeta        |
| wp_comments           |
| wp_links              |
| wp_options            |
| wp_postmeta           |
| wp_posts              |
| wp_term_relationships |
| wp_term_taxonomy      |
| wp_terms              |
| wp_usermeta           |
| wp_users              |
+-----------------------+
11 rows in set (0.00 sec)

At this stage, we can also retrieve data from the table itself with:

SELECT * FROM wp-users;

+----+---------------+------------------------------------+---------------+-----------------------+----------+---------------------+---------------------+-------------+---------------+
| ID | user_login    | user_pass                          | user_nicename | user_email            | user_url | user_registered     | user_activation_key | user_status | display_name  |
+----+---------------+------------------------------------+---------------+-----------------------+----------+---------------------+---------------------+-------------+---------------+
|  1 | root          | $P$BG8CvOmmBA7j0thDd5QPoBrFW0A4ku/ | root          | root@mysuperweb.co.uk |          | 2015-06-25 14:23:14 |                     |           0 | root          |
+----+---------------+------------------------------------+---------------+-----------------------+----------+---------------------+---------------------+-------------+---------------+

We can also look to dump the database if we need to with:

mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` wordpress_c > dump.sql