Skip to content

Databases

The Databases menu shows you every database and login on the server, whoever owns it. It has three pages, one per engine: MySQL, PostgreSQL and MongoDB. Your customers see only their own databases; how they use them is in the customer databases guide.

The three pages

Open Databases › MySQL, Databases › PostgreSQL or Databases › MongoDB. All three work the same way. MySQL is MariaDB underneath.

Each page has two tabs: Databases and Configuration. If the engine is not installed or cannot be reached, the page shows is not available and the reason.

Install PostgreSQL or MongoDB

A Light install has MariaDB only. PostgreSQL and MongoDB come with a Full install, or you can add them later. The Databases pages have no install button. Use the Services page:

  1. Open Server › Services.
  2. Find PostgreSQL or MongoDB. Its state reads not installed.
  3. Click Install.

The install runs in the background and takes a few minutes. When it finishes, the page under Databases works. See Install for Light and Full.

See every database

The Databases tab lists each database with its Account, its Logins and its Size.

  • The Account column links to that account. A database that belongs to BHPanel itself, for example the one webmail uses, shows the panel. It has no controls, only managed here. Dropping it would take webmail away from every customer.
  • no account means no account on this server owns the name. It was left behind by a deleted account or made outside the panel. You can only drop it.
  • Use the search box to find a database. It matches the database name, the account or a login (Database, account or login).

Below the table, the Logins card lists every login on the engine and the databases each one can reach. A login that reaches nothing was made for a database that has since gone, or a create or delete did not finish. It has its own search (Login, account or database).

Every login belongs to the account whose name it begins with. That prefix is the only record of who owns it.

Manage a database or login

Click Manage on a row. As the administrator you can do the same things as the customer, for any account:

  • Password for : type a new password and click Set. Leave the box empty to generate one. A generated password is shown once, in the green message at the top. Copy it then; it is not stored.
  • Add a login: type a suffix and click Create. The new login is named <account>_<suffix>, and its password is shown once.
  • Give an existing login access: choose one of the account's other logins and click Grant.
  • Remove from this database: the login and the data stay.
  • Drop: deletes the database, everything in it, and the login of the same name. Type the database name to confirm. There is no undo short of a backup.
  • Delete this login (in the Logins card): type the login name and click Delete. Anything that signs in with it, such as a site or a cron job, stops working. The data is not touched.

Think before you drop or reset a login. It belongs to a customer, and their site may be using it.

Open phpMyAdmin or Adminer as the server

MySQL opens in phpMyAdmin. PostgreSQL and MongoDB open in Adminer. If the tool is installed, the top of the Databases tab has a card, Open phpMyAdmin as the server or Open Adminer as the server.

  1. Click Open … as the server. It opens in a new tab, already signed in.
  2. When you have finished, come back and click Close all admin logins.

Read these warnings first:

  • The sign-in is a temporary superuser of that engine. It reaches every customer's data and the panel's own tables. There is no permanent password for it anywhere.
  • It is removed automatically after two hours. PostgreSQL also refuses it after that on its own. MySQL and MongoDB have no expiry of their own; only the panel's cleanup ends it. So use Close all admin logins instead of waiting.
  • Close all admin logins removes the temporary logins on all three engines. If one cannot be removed, the page lists what is Still open and says to check that the engine is running.
  • On MySQL, phpMyAdmin hides the system databases (mysql, information_schema and the rest) from its tree. The login can still reach them if you open one by its address.

If the card is missing, the tool is not installed. phpMyAdmin and Adminer are installed from Software › Addons. MongoDB also needs Adminer's MongoDB driver. Adminer's MongoDB support is marked alpha by its authors, so use a MongoDB client for large jobs.

The Configuration tab

The Configuration tab edits the engine's own settings file. The path is shown at the top of the card.

  1. Change the text.
  2. Click Apply (PostgreSQL and MySQL offer Apply — reload and Apply and restart; MongoDB offers Apply and restart). A restart drops every open connection for every account.
  3. The file is checked before it is written. If the engine will not start with it, the previous version is put back and started again.

If a change is refused, your text stays in the box so you can correct it. Discard changes puts the file on disk back. Previous versions keeps a copy before every change; click Restore on one. Settings that are written but not yet in force are listed under waiting for a restart.

One warning for MySQL: do not set bind-address to 0.0.0.0 or turn on skip-name-resolve. The first opens every account's database to the internet. The second refuses applications that connect to 127.0.0.1.

When an account is full

Files and databases share the account's disk limit. When an account reaches its plan, BHPanel holds its databases: they stay readable, but writes are refused. The customer sees a banner on their database pages: Your account is full, so its databases are read-only.

  • MySQL: the account's logins keep only the rights to read and to make room (delete, truncate, drop). They cannot add data or change tables.
  • PostgreSQL: the account's logins and databases default to read-only. If a database grows while held, its logins are refused.
  • MongoDB: the account's users drop to read-only.

The hold is lifted by itself once the account is back under 99% of its plan, or when you raise the plan. You do not need to do anything in the Databases pages. See Plans to raise the disk limit.

Limits per plan

A plan sets how many databases an account may create, for MySQL, PostgreSQL and MongoDB, under What it may create. It also sets database connections per user and the longest database query under Shared services. All of this is in Plans. The Databases pages do not show these limits. Change them on the plan, under Accounts › Packages.

Remote access

There is no setting for remote access on these pages. MariaDB listens on this server's loopback address only, so customers' sites reach it and the internet does not. For a customer to reach their database from their own computer, they use phpMyAdmin or an SSH tunnel.

Do not open the database to the internet by editing bind-address. It exposes every account.