Bỏ qua để đến nội dung
Databases Create and manage MariaDB/MySQL, PostgreSQL and MongoDB databases and users, open web admin tools with one click, and enable vector search for AI.

Databases

Nội dung này hiện chưa có sẵn bằng ngôn ngữ của bạn.

The Databases section of a server (/servers/:id/databases) manages every database engine on that box from one page — create databases and users, browse them in a web admin tool with no password to type, and enable vector search for AI workloads. The page is adaptive: it shows only the engines that are actually installed. MariaDB/MySQL ships on all plans; PostgreSQL and pgvector are free add-ons; MongoDB and the pgAdmin/mongo-express admin tools are Pro.

  1. Make sure you’re on the Databases tab (the toolbar toggles between Databases and Users), then click Create database.
  2. Pick the engine — MariaDB, PostgreSQL or MongoDB (only installed engines appear).
  3. Enter a name. The form validates it against each engine’s rules as you type (Postgres folds to lowercase and wants a leading letter; MariaDB allows a leading letter or _), so you fail in the form, not with a server error.
  4. Optionally create a user alongside it. For MariaDB you can set the password; PostgreSQL and MongoDB auto-generate the account password (their CLI takes no password argument).
  5. Save. The database appears as a card with its size, table/collection count and linked user.

Charset and collation use sensible international defaults (utf8mb4 / utf8mb4_unicode_ci for MariaDB, UTF8 for Postgres) — applied silently so you never have to think about them.

The page is a searchable, filterable grid of database cards (and a Users tab for accounts). Per card and per tab you can:

  • Open a web admin tool — click Open on a card to launch phpMyAdmin (MariaDB), pgAdmin (PostgreSQL) or mongo-express (MongoDB). MZPanel mints a single-use, time-limited magic-login link and drops you straight in, already authenticated — no password to remember.

  • View details — open a card’s detail drawer for tables/collections, charset and collation, server version, and an Optimize (MariaDB) / Vacuum (Postgres) / Compact (Mongo) reclaim action.

  • Back up & restore — the drawer’s Backup & Restore tab, per engine:

    • MariaDB/MySQL: versioned native dumps (mysqldump, gzip) you can download, restore or delete, plus restore from an upload, a URL or a path on the server.
    • MongoDB: Export writes a gzipped mongodump archive under /var/lib/mz/db-dumps (download it from the list), and Restore runs mongorestore from an uploaded archive or a path on the server. Restoring drops and replaces the collections in the archive. The agent keeps no dump list for MongoDB, so the tab lists the exports made in this session; older archives stay on disk (see File manager).
    • PostgreSQL: Export writes a pg_dump custom-format archive (.dump) under /var/lib/mz/db-dumps (download it from the list), and Restore runs pg_restore from an uploaded .dump or a path under /var/lib/mz/db-imports or /var/lib/mz/db-dumps. Restoring drops and recreates every object in the dump, so you type the database name to confirm. It runs in one transaction: if any step fails, nothing changes. Restored objects are owned by the database’s owner role. Needs agent 0.2.163 or newer.

    Big transfers go browser ↔ VPS directly, bypassing the size cap and PHP timeouts of the web tools.

  • Manage users — switch to the Users tab to create MariaDB accounts, set or reset passwords, and grant/revoke access to specific databases. A user card links back to the databases it can reach.

  • PostgreSQL roles — below the MariaDB users, PostgreSQL roles lists every role with the databases it can reach. Create role makes a login role (type a password or leave it blank to have one generated; it is shown once) and can grant it on a database right away. Open a role to grant Owner, Read & write or Read only on a database, remove access, change the password or drop it. Read & write and Read only also cover tables your app creates later. System roles (postgres, superusers) are shown but never changed, and the role that owns a database is removed by dropping the database. Needs agent 0.2.164.

  • MongoDB users — MongoDB users lists the users of your databases (the admin, local and config databases are never touched). Create user adds a user to one database with Read & write, Read only or Owner; open one to change its role or password, or drop it. A database’s own user (the one in its connection details) is removed by dropping the database. Needs agent 0.2.164.

  • Filter and search — the engine filter appears only when two or more engines hold data; search matches database or user names.

  • Enable pgvector — on a PostgreSQL database, flip on the vector extension inline for AI/RAG (see below). The sparkle badge on the card shows the state: violet = enabled, muted = not enabled (click to enable), ? = unknown. The status is a live read, so while the agent is offline or the read fails the badge shows the last-known state or ? with the reason, and the list shows the read error inline — it never offers Enable on a guess.

  • Engine settings — the gear button opens per-engine Settings: status, performance tuning (MariaDB buffer pool / max connections), and remote access (bind local vs. remote, port, and a Postgres IP allowlist).

For RAG and other AI workloads you have two paths:

  • pgvector — enable the vector extension on an existing PostgreSQL database right from its card. This reuses your Postgres instance, so there’s no extra service to run. It’s a free add-on (it just needs PostgreSQL installed).
  • Qdrant — for a purpose-built vector store, deploy Qdrant from the Marketplace as a managed Docker app. Choose pgvector when you already run Postgres and want vectors next to relational data; choose Qdrant when you want a dedicated vector engine.

Once a Qdrant container runs on the server, the Databases tab shows a Qdrant card: status and version, every collection with its point count, vector size and distance, and disk size. Create a collection (name, vector size = your embedding model’s dimension, distance Cosine / Dot / Euclid / Manhattan) or delete one (all its points go). When the API is protected, Reveal key shows the API key your app sends as the api-key header; it is never stored by MZPanel. Needs agent 0.2.164.

Every action dispatches a job to the server’s agent, which runs it natively and streams the result back. The engines map to three job families:

AreaJob kindsAgent runs
MariaDB/MySQLdb.list, db.create, db.drop, db.user-*, db.export, db.import, db.optimizemz db … (native mysql/mysqldump)
PostgreSQLpg.db-list, pg.db-create, pg.db-drop, pg.detail, pg.vacuum, pg.vector-*, pg.role-*mz pg … (native psql)
MongoDBmongo.db-list, mongo.db-create, mongo.db-drop, mongo.collections, mongo.compact, mongo.export, mongo.import, mongo.user-*mz mongo … (native mongodump/mongorestore/mongosh)
Qdrantqdrant.status, qdrant.collection-create, qdrant.collection-delete, qdrant.api-keythe agent calls the Qdrant REST API on the box

The database and user lists render from the agent-pushed inventory cache, so the page loads instantly and even an offline box shows its last-known real databases (never mock rows). Live actions — create, drop, export/import, opening an admin tool — need the agent online. Which engines are “installed” is read from the same cache (the extensions snapshot), so the page never fires a live query against an engine that isn’t there.

The web admin tools are served over the agent’s existing WebSocket, so the app listens on localhost on the box and you stay on an mzpanel.com host the whole time — the box’s IP is never exposed in your browser.

Every action here maps to an mz command on the box — the same engine the dashboard drives:

Terminal window
mz db list --json # every database on the box
mz db create appdb --user appuser --pass '…' --json
mz db export appdb --gzip --json # native mysqldump
mz db import appdb --file /path/dump.sql --json
mz db pma example.com --json # per-site phpMyAdmin magic link
mz pg db list --json # PostgreSQL databases
mz mongo db list --json # MongoDB databases
mz mongo export appdb --json # mongodump archive → {path, bytes}
mz mongo import appdb /var/lib/mz/db-dumps/appdb-….archive.gz
mz pg export appdb --json # pg_dump -Fc → {path, bytes}
mz pg import appdb /var/lib/mz/db-dumps/appdb-….dump --json

Always pass a sub-action and --json for machine output. See The mz CLI and the command catalog.

GoalMCP toolJob kind
List databasesdb_list (MariaDB/MySQL), servers_inventory with kind databases (cached)db.list, pg.db-list, mongo.db-list
Create a database + userjobs_createdb.create, pg.db-create, mongo.db-create
Users and grants (MariaDB)jobs_createdb.user-*
PostgreSQL rolesjobs_createpg.role-list, pg.role-create {name, pass?, db?, access?}, pg.role-grant {name, db, access}, pg.role-revoke {name, db}, pg.role-passwd {name, pass?}, pg.role-drop {name}
MongoDB usersjobs_createmongo.user-list, mongo.user-create {user, db, role?, pass?}, mongo.user-passwd {user, db, pass?}, mongo.user-role {user, db, role}, mongo.user-drop {user, db}
Qdrant collectionsjobs_createqdrant.status, qdrant.collection-create {name, size, distance?}, qdrant.collection-delete {name}
Export / importjobs_createdb.export, db.import, mongo.export, mongo.import, pg.export {db}, pg.import {db, file}
Enable pgvectorjobs_createpg.vector-*
Install an enginejobs_createextension.install {id: postgres|mongodb|pgadmin…} (full)

Dropping a database, user or collection (db.drop, db.user-drop, pg.db-drop, mongo.db-drop, pg.role-drop, mongo.user-drop, qdrant.collection-delete) needs the data:delete scope. A pass you send is sealed to the server, never stored; leave it out and the job prints a generated password once (the job keeps no output, so read it from the stream). qdrant.api-key is dashboard-only; imports (db.import, mongo.import, pg.import) need backups:restore. pg.export returns {ok, path, bytes}; pass that path (or a file name in /var/lib/mz/db-imports) to pg.import. Both run up to an hour — poll jobs_get. The phpMyAdmin login kinds (db.pma, db.pma-admin) are dashboard-only. Call jobs_schema for each body.

  • Import overwrites the target. Importing a dump replaces the target database’s contents (a MongoDB restore drops each collection in the archive first). Take a backup first.
  • MongoDB restore paths. mongo.import takes an absolute path, or a file name that is looked up in /var/lib/mz/db-imports (where dashboard uploads land).
  • PostgreSQL restore paths and errors. pg.import only reads files inside /var/lib/mz/db-imports or /var/lib/mz/db-dumps (a bare file name means the imports dir); anything else fails with bad_path. bad_archive means the file is not a custom-format dump (make it with pg_dump -Fc, not plain SQL); missing_extension means the dump uses an extension this server cannot create (install it first, e.g. pgvector); import_failed rolled back and shows the first PostgreSQL error.
  • Protected accounts. PostgreSQL postgres, pg_* and superuser roles (protected_role), MongoDB’s admin/local/config databases (protected_db) and the mz Mongo admin (protected_user) are never changed. The role that owns a database (owns_database) or a database’s own Mongo user (primary_user) is removed by dropping the database. Grants only target databases MZPanel manages (not_managed otherwise).
  • Changing a password breaks old connections. Apps that use the old password lose access until you update them (for a database’s own account the server’s stored connection details follow).
  • Opening a tool needs the agent online. phpMyAdmin, pgAdmin and mongo-express all require a live agent to mint the magic link — an offline server shows an inline notice instead. If your browser blocks the popup, the page falls back to a clickable single-use link.
  • Admin tools must be installed. Tiers come from the extension catalog, not the plan table: MariaDB, MySQL, PostgreSQL, pgvector and phpMyAdmin are free; MongoDB and pgAdmin are Pro. Installing a Pro extension on a lower plan returns 403 tier_required (“MongoDB requires the PRO plan or higher.”). mongo-express follows MongoDB — install them from Extensions if the Open button reports the tool isn’t present.
  • Databases aren’t public by default. Engines bind to localhost. To reach one from an external client, use the engine Settings → remote access (Postgres gates on a tight IP allowlist).
  • Cron jobs — scheduled tasks on the same server.
  • Backups — protect a database before an import or drop.
  • Marketplace — install PostgreSQL, MongoDB, admin tools or Qdrant.
  • The mz CLI — driving the box from the command line.