Databases
Applications with a database get their own database, and with MySQL (MariaDB) or MySQL 8 you can add more. Open the application and go to Database › Databases. Two tabs at the top switch between Databases and Users.
The application’s main database
Section titled “The application’s main database”Each database has its own card on the Databases tab, with its engine and version, its size and how many users can reach it. The main database comes first, marked Main database of this application. Its card also shows the login the application itself uses: Database name, Database user, Host (localhost), Port and Password. Click the eye to reveal the password, or the copy buttons to copy any value. Copy all as connection details copies them all at once.
On a WordPress application these are the values in wp-config.php. A Custom PHP application reads them with getenv() (see Connect to the database), and a Laravel application deployed from Git gets them in its .env. For a Node.js application, add them to its environment. The database accepts connections only from the server itself: from the application, or over SSH.
Click Open Adminer on a database’s card to manage it in your browser. Adminer opens in a new tab, already signed in. Adminer runs on PHP, so Node.js applications don’t have it.
The main database and its user can’t be deleted, and the user’s access to it is fixed.
Add a database
Section titled “Add a database”- On the Databases tab, click Add database.
- Type a Database name using letters, numbers and
_(up to 64 characters). - Click Add database.
An application can have up to 100 added databases and 100 added database users.
Add a database user
Section titled “Add a database user”- On the Users tab, click Add user. You need at least one database first.
- Fill in Username (letters, numbers,
$and_, up to 32 characters), choose the Database it gets access to, and type a Password of at least 10 characters, or click Generate. - Click Add user.
Change who can use a database
Section titled “Change who can use a database”On a database’s card, open the More actions menu (⋮) and choose Users and access. Under User access, choose each user’s level:
- None
- Read Only
- Read & Write Only
- Full
- Custom, to pick the exact permissions.
You can also start from the user: on the Users tab, click Manage on the user and set its access under Database access.
Import or export SQL files
Section titled “Import or export SQL files”On applications with a MySQL (MariaDB) or MySQL 8 database, each database card has Export, and the main database also has Import:
- Import: click Import on the main database’s card. Under Import SQL file, click Choose file, pick a
.sqlfile up to 10 GB, then click Import. The import replaces the database’s contents. Netkeel takes a safety backup of the application first and imports in the background. Follow it in the activity panel. Large files upload in parts and carry on if the connection drops; keep the tab open until the upload is received. - Export: click Export on a database’s card to download it as a
.sqlfile.
Added databases don’t take imports here. To import into one, or to import a .sql.gz file, use Adminer: click Open Adminer, then Import, choose the file under File upload and click Execute. Adminer takes files up to the application’s Upload max filesize (128 MB by default, up to 1 GB under PHP settings). For a larger file, use SSH and the mysql command, as in Move a site to Netkeel.
Adminer signs in as the application’s own database user, so it opens an added database only while that user has access to it (see Change who can use a database). Node.js applications have no Adminer.
To import or export a PostgreSQL database, use a database client over SSH. See PostgreSQL databases.
To move a whole WordPress application, with its files, use backups or Backups › Import & export. To bring a site from another host, see Move a site to Netkeel.
Reset a user’s password
Section titled “Reset a user’s password”On the Users tab, click Manage on a user. Under Reset password, type a new password or generate one, and click Update password. For the application’s own database user on a WordPress application, Netkeel writes the new password into the application’s configuration in the same step, so the application keeps working. On a Custom PHP application, PHP gets the new password in the same step, so code that reads DB_PASSWORD with getenv() keeps working. On a Laravel application, update DB_PASSWORD under Laravel › Environment (.env). On a Node.js application, update its environment with the new password yourself.
Delete a database or user
Section titled “Delete a database or user”Open the More actions menu (⋮) on an added database’s or user’s card and choose Delete database or Delete user.