SFTP, SSH, files, database and logs on a hosted site
Last updated
Most of the time you will work on a hosted site through WordPress itself or the tools in your dashboard. Sometimes you need direct access: to upload a theme, run a command, look inside the database or read an error log.
This guide covers the SFTP & SSH, Files, Database, WP-CLI and Logs tabs, found under WP tools in a hosted site’s control panel.
Why logins use SSH keys, not passwords
Every SFTP and SSH login signs in with an SSH key, never a password. An SSH key comes in two halves: a private key that stays on your computer, and a public key that you paste into MaintainHQ. Only someone holding the private key can sign in.
If you do not have a key yet, most computers can make one with the command ssh-keygen -t ed25519. The public key is the line that starts with ssh-ed25519, usually in a file ending .pub.
Add an SFTP or SSH login
- Open the site from the Hosting page, then WP tools, then SFTP & SSH.
- Under Add a login, choose a Type. SFTP: files only. SSH: command line, WP-CLI, Git and database.
- Optionally type a User name. If you leave it empty, one is made for you.
- Paste your Public key.
- Click Add SFTP login (or Add SSH login). It works within a minute.
The table shows each login with its user name, key fingerprint, type and status. Click Remove to take one away.
Each login reaches this site only. If the SSH option says "after the next server update", the server this site is on has not had the update that enables it yet; SFTP works in the meantime.
Connecting
The Connection details card shows the host (the server’s IP address) and port 22. Once you have a login, it also shows the exact command to copy.
- SFTP: use the sftp command shown, or put the same host, port, user name and your private key into any SFTP app.
- SSH: use the ssh command shown. You start in the site’s files; try wp plugin list to see its plugins.
- Git over SSH: from an SSH login, you can clone a repository, for example into wp-content/themes.
WordPress itself is in the public folder. The site’s access and PHP logs are in the logs folder. Files you add can also be changed by WordPress.
Files and WP-CLI in the browser
You do not need any software for small jobs. The Files tab is a file manager in your dashboard, and the WP-CLI tab is a console for WP-CLI, WordPress’s command-line tool. Both are included with hosting and work once the site is live and connected.
The database
Each hosted site has its own MariaDB database (MariaDB works the same way as MySQL). Open WP tools, then Database.
phpMyAdmin
Click Open phpMyAdmin to browse tables, run SQL and import or export, signed in to this site’s database only, with no password to type. If the site has a staging copy on MaintainHQ Hosting too, you get Open live database and Open staging database buttons: they are separate databases.
phpMyAdmin needs the site’s SSL certificate, which every hosted site gets within a few minutes of being created.
Reset database password
Click Reset database password and confirm. A new password is set on the database and written into wp-config.php at the same time, so WordPress keeps working. Anything else that used the old password, such as a database app, needs the new one.
Database details and tunnels
Click Show database details to see the host, port, database name, user and password. The password is the one in wp-config.php; it is shown to you only and is not kept by MaintainHQ.
The database only accepts connections from the server itself, so to use an app on your computer you connect through an SSH tunnel (a private link through your SSH login). With an SSH login added, the Connecting card shows the tunnel command; you then point your app at 127.0.0.1 port 3307. It also shows wp db cli and wp db export commands for use on the server.
Logs
The Logs tab reads the last 200 lines of a log from the server when you ask. Choose a log and click Show.
| Log | Use it for |
|---|---|
| PHP errors | White screens, "critical error" messages and plugin crashes. Start here. |
| Web server errors | Requests the web server could not serve. |
| Access log | Who requested which pages, and the response each got. |
| Slow PHP requests | Pages that take a long time to build. |
Logs can be read once the site is on the server. If a log is empty, nothing has been written to it recently.