A Cito server runs one database engine: MySQL or PostgreSQL. This is chosen when the server is ordered and cannot be changed afterwards. This page covers servers running PostgreSQL. If your server runs MySQL, see Managing MySQL Databases instead. Everything on this page can be found by clicking ‘Databases’ in the sidebar, or in the ‘Databases’ section of a site’s settings.
Not sure which engine your server runs? Create a database, or look at the connection details of an existing one. A PostgreSQL server shows port 5432, a MySQL server shows port 3306.

Creating a database

The Databases page lists every database on the server, with its users, the site that owns it and its size. You can use the search bar to filter for specific databases, and the ‘All servers’ checkbox to search for databases on other servers, if you have more than one. Database list To add a new database, click the ‘Create Database’ button in the top right corner. You will be prompted for a database name, username and password, and for the site that should own the database. See Database ownership for more about owners. PostgreSQL names are stricter than MySQL names:
  • Lowercase letters, numbers and underscores only. No capital letters and no hyphens.
  • The name must start with a letter or an underscore.
  • A database name can be up to 56 characters long, a username up to 63.
  • The names postgres, template0 and template1, and anything starting with pg_ or cito_, are reserved.
Once created, you will see the new database details displayed to you. New database details
Passwords are only shown onceWe do not display database passwords again after this screen. Click the icon next to the password field to copy it to your clipboard. If you lose a password you’ll need to reset it.

Connecting to a database

Sites on the server connect to PostgreSQL with these details: When you create a Laravel or Craft CMS site, Cito creates the database for you, writes these details into the site’s .env file, and shows them as a connection string you can copy: Connection details You can paste the connection string straight into psql when logged in to the server over SSH:
A database user can only connect to the databases it has been given access to. It cannot see or connect to another site’s database.

Managing users

You can manage a database’s users by clicking the User icon next to the database. This lets you add more users, change what a user can do, or reset a user’s password. When you add a user you choose between two kinds of access:
  • All privileges (recommended). The user can do anything in the database, including creating, altering and dropping tables. Every user with all privileges can work with every table in the database, whichever of them created it.
  • Specific privileges. The user can only do what you tick, on every table in the database, including tables created later. For example, tick only SELECT to create a read-only user.
User privileges The privileges you can choose from are:
Creating, altering and dropping tables cannot be granted on their own in PostgreSQL. A user that needs to change the structure of the database needs all privileges.
Changing a user’s privileges, or removing a user, takes effect straight away. Any connections that user has open to the database are closed, so an application using it will reconnect. Removing a user from a database deletes the user too, unless it still has access to another database.

Cloning databases

It can be useful to clone a database, for example if you need a copy of it for testing purposes. Cloning creates a new database with its own new user. The original database’s other users are not copied. To clone a database, click the Clone icon in the actions menu on the Databases page. You’ll need to specify a name for the new database, and a username and password for its user. Click Clone to start the process. You can carry on using the original database while it is being cloned. Large databases may take a few moments to complete.

What’s different on a PostgreSQL server

Most of Cito works the same whichever database engine your server runs. A few things that depend on MySQL are not available:
  • WordPress, Magento and PrestaShop sites cannot be created, as these applications need MySQL. Laravel, Craft CMS, PHP, Node.js and the other site types are all available.
  • phpMyAdmin is not available, as it only manages MySQL. Use psql over SSH, or your own PostgreSQL client.
  • Migrations from cPanel and WHM are not available, as the sites they bring across use MySQL databases.
  • When you clone a site, its databases are cloned too, but the ‘Replace URLs in DB’ and ‘Auto-reconfigure’ options are WordPress features and are not offered. Update the cloned site’s configuration (for example its .env file) with the new database details yourself.

Connecting from containers

Container sites use the server’s PostgreSQL like any other site. Create the database from the site’s Databases tab, then connect to it from inside your containers using this host:
The host is also shown at the top of a container site’s Databases tab with a copy button, and in the Host field when you create a database. Connections from containers arrive at PostgreSQL from the server itself, so the database users Cito creates work as they are. PostgreSQL is not exposed to the internet.

Remote database access

For security purposes, remote access to PostgreSQL is disallowed by default. Please contact support if you need to connect remotely using a tool such as pgAdmin, DBeaver or TablePlus.

Restoring databases

To restore a database from a backup, please contact support.

Orphaned databases

In Cito all databases are owned by (i.e. associated with) a site. If you see a message about an orphaned database, find that database and use the dropdown menu to assign it to a site. This only needs to be done once. More information can be found at Database ownership.