Databases and backups
Install an engine from Services, then select it in Database manager. Use Copy password when a graphical client prompts you. Each engine owns its own data directory and credentials.
| Engine | CLI name | Default address | Local account |
|---|---|---|---|
| PostgreSQL | postgres |
127.0.0.1:5432 |
postgres |
| MariaDB | mariadb |
127.0.0.1:3307 |
root |
| MySQL | mysql |
127.0.0.1:3306 |
root |
Use .\portstack.exe ports for the current ports, including any overrides.
Choose a database client
HeidiSQL Portable is the desktop option from Portstack 0.5. Select the engine and choose Install and open HeidiSQL on first use. Subsequent launches show Open HeidiSQL. The launcher starts the engine, selects the local connection and lets you enter the password. PHP is optional for this route. Use Updates and tools for installation and release checks. HeidiSQL
.\portstack.exe heidi install
.\portstack.exe db heidi postgres
Portstack 0.5 supports the HeidiSQL 12.x portable settings format. If a newer major release changes that format, the updater keeps the installed version and reports that a newer Portstack adapter is needed. The workspace stores a separate HeidiSQL profile for each engine.
Adminer is included for quick browser access. Install PHP as well as the engine. Choose Open Adminer, or run portstack db manage postgres. Portstack starts both services and fills in the login address and username. The password stays out of the URL.
Interactive SQL uses each engine’s own client. Start the engine, then run portstack db console postgres, portstack db console mariadb or portstack db console mysql. Use \q to leave psql, or exit to leave the MySQL or MariaDB client.
Back up and restore a database
The following PowerShell example assumes PostgreSQL is running, the shop database exists and E: is your backup drive. Change those names to suit your installation. Choose a new, unused name for the restore.
New-Item -ItemType Directory -Force 'E:\PortstackBackups' | Out-Null
$backup = .\portstack.exe db backup postgres shop --to 'E:\PortstackBackups' | ConvertFrom-Json
.\portstack.exe backup verify $backup.dump
.\portstack.exe db restore postgres $backup.dump --as shop_restored
.\portstack.exe db list postgres
Open shop_restored and check its tables before relying on it. PostgreSQL uses a native custom-format dump. MySQL and MariaDB use SQL. Keep the dump and its verification metadata together. Portstack verifies the checksum and refuses to overwrite an existing database on restore.
To save a destination for later backups, use portstack backup directory 'E:\PortstackBackups'. portstack backup list shows the inventory in the configured folder. portstack backup directory --reset returns to the workspace default. Older dumps without Portstack metadata can be imported through the appropriate vendor client.