Databases
Create MariaDB, PostgreSQL and MongoDB databases, give users access, connect from your website or your computer, and manage tables in the browser.
Most web applications, such as WordPress, keep their content in a database. In ScalPanel you manage databases on one page: Email & databases → Databases.
Working with a database always takes three steps:
- Create a database.
- Create a database user. ScalPanel generates its password.
- Give the user access to the database.
Your website then connects with the user's name and password.
Database engines
ScalPanel can offer three database engines. Your provider decides which ones your plan has.
| Engine | Used by |
|---|---|
| MariaDB | WordPress and most PHP applications (compatible with MySQL) |
| PostgreSQL | Many Python, Ruby and Node.js applications |
| MongoDB | Applications that store documents instead of tables |
If you are not sure, choose MariaDB.
When your provider offers more than one version of an engine, you choose the version with your first database of that engine. All your later databases of that engine use the same version, so your users and their access keep working across them. Each database shows its engine and version in the list.
Create a database
- Open Email & databases → Databases.
- Click New database.
- Choose the Engine and, if offered, the Version.
- Enter a Name: up to 16 lowercase letters, digits and
_. - Click Create database.
The database is created in a few seconds.
The name prefix
Every database and database user name starts with your account's prefix and an underscore. If your prefix is shopown and you type shop, the full name is shopown_shop. Always use the full name, as shown in the list, in your application's settings.
The prefix comes from your account's user name. It is the same for all your databases and users and keeps your names apart from other accounts on the same server.
Create a database user
- In the Database users card, click New user.
- Choose the Engine (a user reaches databases of its own engine) and enter a Name.
- Click Create user.
- Copy the password from the dialog and keep it somewhere safe.
Warning: The password is shown only once. If you lose it, click New password next to the user. ScalPanel generates a new one, and the old one stops working, so update your application's settings too.
Your plan may limit how many connections one user can open at a time. The Max connections column shows the limit. It may also limit the queries, writes and new connections per hour, and how long one query may run: a script over such a limit gets an error such as "has exceeded the 'max_queries_per_hour' resource" until the hour is over. Ask your provider for a larger plan if your site needs more.
Give a user access
- In Database users, click Access next to the user.
- For each database, choose:
- No access;
- Read-only: the user can read data (SELECT, SHOW VIEW);
- Full access: the user can also change data and the schema of that database.
- Click Apply. The change applies within a few seconds.
Full access is always limited to that one database. A user never gets rights on other accounts' databases or on the server itself.
Connect from your website
Open the Connecting from your websites card. Choose a database to see its Host, Port, Database and User, and a command line you can copy.
- For MariaDB, your website uses
localhostas the host. This also works in cron jobs and WP-CLI. - For PostgreSQL, MongoDB and other database servers, the card shows
127.0.0.1and a port. - These addresses work only from your websites on the hosting servers, not from the internet.
Enter these values in your application's configuration, for example wp-config.php for WordPress.
Connect from your computer (remote access)
To use a desktop database tool or connect from another server, allow its public IP address.
- In the Remote access card, click Allow an address.
- Enter the IP address or network: an IPv4 address, or a network such as
203.0.113.0/24(at most/16). Search the web for "what is my IP" to find yours. - Add a Description, such as "office", and save.
The card lists the host and port for each engine. Connect with your database user and password. Connections from addresses that are not on the list are refused.
Limits:
- Only public IPv4 addresses are accepted. IPv6 is not supported yet.
- Your plan sets how many addresses you can add.
- When you remove an address, new connections from it are refused within a minute.
If the card says Remote access is not available for your account, ask your provider.
Manage tables in the browser
Database manager
Click Database manager at the top of the Databases card. It opens a full database tool (Adminer) in a new tab, already signed in to your account's databases. It works for MariaDB, PostgreSQL and MongoDB; its MongoDB support is basic. If you have databases of several engines, there is one button per engine, such as Database manager (PostgreSQL).
The session ends after one hour. Open the manager from the panel again to continue.
Database console
For MariaDB databases, click Open next to the database. The Database console lets you:
- browse the Tables and their rows;
- run one SQL statement at a time in the SQL box and see the Result.
Each statement may run for at most 10 seconds and shows at most 500 rows. The console has full rights on this one database only.
Check and repair
The Check and repair card on the console page (MariaDB only) has three buttons:
- Check tables looks for damaged tables;
- Repair tables fixes MyISAM and Aria tables;
- Optimize tables reclaims unused space.
Each runs on every table of the database, for at most 45 seconds, and then shows a summary such as "All 12 tables are fine".
PostgreSQL and MongoDB maintain their tables on their own, so they have no console and no check and repair card.
Export, back up and delete
Next to each ready database:
- Export downloads a compressed dump: a
.sql.gzfile for MariaDB and PostgreSQL, an.archive.gzfile for MongoDB. - Backups shows the automatic backups, with Back up now and Restore. See Backups.
- Delete removes the database.
Warning: Deleting a database cannot be undone. Export it or check its backups first.
Limits and read-only access
- Your plan may limit how many databases you can create and how much space they use. The page warns you when a limit is reached.
- If your provider has made databases read-only for your account, you can see them but not change them.
- To create or change databases, your user needs the database management permission. See Account users.
ScalPanel does not offer a separate "import" button on the Databases page. To load an existing dump, use the Database manager, or the command line over SSH.