Skip to content
How to install

A site's database

A site keeps its WordPress data in a MariaDB database on its server. The site’s Database tab shows how to connect to it, and a browser for its tables and rows.

Since 0.3.3 A PHP site may have no database. Its tab then says “This site has no database.” and offers Create database.

A site's Database tab with its connection, two databases and the wp_options table open
A site's Database tab with its connection, two databases and the wp_options table open

The Connection card names the Database, the User, the Host and, on a WordPress site, the Table prefix. Show reveals the password, and the panel logs who asked. Only the sites on the same server can connect. MariaDB has no port open to the internet.

  1. Under Browse, pick a table on the left.
  2. Choose a column’s name to sort by it.
  3. Choose a row to open it. Change its values, then choose Save. Delete row removes it.
  4. Insert row adds a row. Columns left empty take their default.

The panel finds a row by its primary key. A table without one, and a view, are read only here.

Above the rows, pick a column, a comparison and a value, then choose Search.

  • Add condition adds another line. Match all keeps the rows that meet every line, and Match any the rows that meet one.
  • Any column looks in every column of the table at once, as text, binary ones left out.
  • is one of takes values apart by commas: 12, 15, 40.
  • = with no value finds empty text.
  • Clear shows every row again.

Structure above the rows lists the table’s columns, indexes and foreign keys, with the forms that change them. New beside the table filter makes a table. See Change a table’s structure.

WordPress stores lists as PHP serialized text, such as the active plugins in wp_options. Such a value offers Edit as PHP data. Change its entries there, and the panel writes it back with every length counted again. A length that is off by one byte would empty the whole option.

The active_plugins option open, its two plugins edited as PHP data

SQL opens an editor. Run, or Ctrl+Enter, runs the statements one after another and stops at the first error. Each statement shows its rows, or how many rows it changed. Recent queries keeps what you ran, in this browser.

A change on this tab empties a WordPress site’s caches. A single SELECT, SHOW, DESCRIBE or EXPLAIN does not.

The SQL view with a query and its result
  • Export downloads a dump of the database as a .sql.gz file.
  • Import loads a .sql or .sql.gz file. It backs the site up first, unless you switch Back up the site first off.
  • Delete every table in the database first makes it hold exactly what the dump makes.

The site is stopped while a dump goes into its own database. It is started again only if the database then holds a WordPress installation, whether the import worked or failed: without one, anyone could run WordPress’s installer. A dump whose tables have another prefix leaves none, for example. A PHP site is started again whatever the dump held. To undo an import, restore the backup taken before it.

The panel reads the dump before it changes anything. It refuses a file that is not a dump, and a dump that switches to another database with USE or CREATE DATABASE. With every table of a WordPress site’s own database deleted first, it also refuses a dump without the site’s options table, such as wp_options.

Change password gives the database user a new password. WordPress restarts with it, so the site is offline for a few seconds. The panel refuses when wp-config.php sets the password itself, or cannot be read. If the site stops answering with the new password, the old one is put back.

On a PHP site, nothing restarts, and the site’s own config keeps the old password. Show reveals the new one. Put it in the config, or the site loses its database.

A container app whose environment names {{db.password}} gets a new container with the new password, behind its health check. If that fails, the old password is put back. An app that reads its password from its own config is like a PHP site.

Every query runs as the site’s own database user. MariaDB keeps it to that site’s databases, so it cannot see another site’s data or MariaDB’s own users. An import runs as that user too, and a dump cannot run commands or read files on the server.

Adminer beside a database opens it in Adminer in a new tab, for what this tab does not do.

  • A statement runs for at most 50 seconds from the SQL editor, and 20 seconds while browsing.
  • The SQL editor shows the first 1,000 rows of a result, then stops the statement.
  • A value over 1 MiB, and binary data, can only be changed with SQL.
  • An import takes up to 4 GB, compressed, and up to two hours to load.
  • A view, trigger or routine in a dump whose DEFINER is another database user does not load. Remove the DEFINER clauses first.
  • Changes wait while a restore, import or move runs on the site. A backup does not block them.