Databases
Use the Database menu (page title Databases) to create MySQL/MariaDB and PostgreSQL databases, manage users and their privileges, import and export SQL files, and open phpMyAdmin or AdminNeo without a password.
Connection information
The Connection information box at the top holds the details for configuring your application:
| Field | Shows |
|---|---|
| Host | The database host. For applications on this hosting it is usually localhost. |
| Port | The MySQL/MariaDB port, usually 3306. |
| Database prefix | The prefix of database and user names, e.g. jane_. |
| Remote access | The address and port for connections from outside the server. Only shown when your package includes remote database access. See Remote database access. |
Click the copy icon next to a value to copy it.
Name prefix
Every database and user name gets the account prefix. If you type shop, the full name becomes jane_shop. Use the full name in your application's configuration.
Summary
| Card | Shows |
|---|---|
| Databases | Number of databases against the package limit. The limit counts MySQL/MariaDB and PostgreSQL together. |
| Total size | Size of all databases, against the account's disk quota. |
| Database users | Number of users and how many have access to a database. |
Creating a database (wizard)
The quickest way to create a database together with its user:
- Click Create DB. Or use Create database on the Overview.
- Enter the Database name, e.g.
shop. - Optional: enter the User name (optional). Empty means the same as the database name.
- Enter a Password, or click Generate. At least 10 characters.
- Click the create button.
The panel creates the database, creates the user, and gives that user All privileges on the database. When it is done, the panel shows the Database, User, Password, and Host. Copy them all for your application, then click Done.
WARNING
The database user's password cannot be viewed again after the dialog closes. If you forget it, change the user's password from Manage.
Creating a separate database user
- Click Create User.
- Enter the Username. The name is saved with the account prefix.
- Enter a Password or click Generate. At least 10 characters.
- Click Create.
A new user has no access to any database yet. Grant access from Manage on the database or on the user.
Managing privileges
From the database
- Click Manage on the database row.
- In Grant access to, choose a user.
- In Privileges, choose All privileges or Read only.
- Click Grant.
To revoke, click Revoke on the user row.
From the user
- Click Manage on the user row.
- In Database access, choose a database and its privileges, then click Grant.
- To change the password, enter the New password and click Change password. Update your application's configuration afterwards.
The Privileges column in the user table summarizes the user's privileges: All privileges, Read only, Mixed, or No database access.
Deleting a database or user
- Database: open Manage on the database, click Delete database, and confirm.
- User: open Manage on the user, click Delete user, and confirm.
DANGER
Deleting a database deletes all its tables and data. Export the database first if you might need it again.
Exporting a database
- Click Export on the database row.
- Wait for the job to finish.
- Open the File Manager, go to the
db-exportsfolder, and download the file.
The export is saved as ~/db-exports/<database>-<date-time>.sql.gz. The file has no CREATE DATABASE/USE statements, so it can be imported into another database. Export files count toward the account's disk quota. Delete old files you no longer need.
Importing a database
- Upload a
.sqlor.sql.gzfile to your home folder with the File Manager, e.g. tobackup/site.sql.gz. - Click Import on the target database row.
- Enter the File in your home folder (.sql or .sql.gz), e.g.
backup/site.sql.gz. - Click the import button.
The import runs in the background. DEFINER clauses from the old server are removed automatically, so views and triggers keep working.
WARNING
The statements in the file run on this database. Tables with the same name can be overwritten. If an import fails partway, the statements before the failing line have already run. Export the target database before importing.
phpMyAdmin
Click Open phpMyAdmin in the connection information box. phpMyAdmin opens in a new tab and signs in without a password, with access to all MySQL/MariaDB databases of the account.
- The link is single-use and valid for 60 seconds.
- A phpMyAdmin session ends after about 4 hours at most. Open it again from the panel when the session expires.
- New databases are still created from the panel, not from phpMyAdmin, because they are tied to the package quota.
The button is not shown when phpMyAdmin is not installed on the server.
Remote database access
The Remote database access panel lets applications or tools on other computers (e.g. a desktop SQL client or a reporting server) connect to your MySQL/MariaDB databases, like Remote MySQL in cPanel.
In Add host, enter the address of the computer that connects:
Entry Example Allows IPv4 address 203.0.113.7That address only. Range (CIDR) 203.0.113.0/24All addresses in the range. Range (wildcard) 203.0.113.%All addresses in the range. Any address %Every address. The panel asks you to confirm. Click Add.
The panel shows the Server and Port to use in your remote application. Use the same user names and passwords as on this server: every database user can sign in from the allowed hosts with the same password and privileges. The server firewall opens the MySQL port only for the hosts you allowed.
- At most 20 hosts per account.
- Click Remove on a host row to revoke it.
- IPv6 addresses are not supported yet.
- Users with custom privileges are not copied to the remote hosts. Use All privileges or Read only.
- Without any host, databases accept connections from this server only.
WARNING
Allowing % (any address) leaves your databases protected only by their passwords. Prefer a single address or a small range, and use strong database passwords.
If the panel says remote access is not included in your hosting package, or that MySQL on this server does not accept network connections yet, contact your hosting provider.
PostgreSQL
The PostgreSQL card appears on the same page. If the server does not provide PostgreSQL, the card shows "PostgreSQL is not available on this account's server."
The card shows the host, port, and name prefix. The package database quota counts MariaDB and PostgreSQL together.
Creating a PostgreSQL database
- Click New PostgreSQL database.
- Enter the Database name.
- Choose an Existing user, or choose — create a new user — and enter the New user (optional) and its password.
- Choose the access: All (owner) or Read only.
- Click Create.
PostgreSQL user passwords are at least 8 characters. Change one with the Password button in the user list. Users marked locked cannot sign in.
AdminNeo
Click Open AdminNeo to manage the content of PostgreSQL databases, the equivalent of phpMyAdmin for MariaDB. AdminNeo opens in a new tab with a single-use link, and its session lasts up to 4 hours. AdminNeo has no login form, so it can only be opened from the panel.
Create a PostgreSQL database first. The AdminNeo button is only enabled when a database exists.
Database optimizer
The Database optimizer card helps you maintain tables and find the cause of a slow site.
Table maintenance
Table maintenance lists all databases, both MariaDB and PostgreSQL, with four actions per database:
| Action | Use |
|---|---|
| Check | Checks tables for corruption. |
| Analyze | Updates index statistics so queries run faster. |
| Optimize | Rebuilds tables and reclaims wasted space. Run it outside busy hours. |
| Repair | Repairs corrupted tables. Tables are locked briefly. |
Tables that need attention
Tables that need attention flags tables with No primary key, No index, or Wasted space.
Slow queries
Slow queries shows the slowest queries in the Last 24 hours or Last 7 days, with their count, total and maximum time, and the average rows read. Values inside queries are hidden (?).
TIP
A query that reads many rows usually needs an index on the columns in its WHERE or JOIN.
Redis object cache
Redis and Memcached object cache for WordPress and other PHP applications are set on the Application page. See Object cache.
See also
- Files (File Manager)
- Backup for restoring a single database
- Apps and Redis
- WordPress Manager
- Remote database access (admin)
