Create and connect a database
Create a database for your site, then connect your application. This walkthrough uses MySQL and a Laravel configuration example. The screens contain demonstration records only. No live database or application is changed.
Before you begin, create the site in Herne, confirm permission to change it, and check that its plan has room for another database. Ask the administrator which database engines and application drivers are available. For the connection steps, have the application files ready and keep a backup of any existing configuration and data.
The screenshots show Herne 3.55.43 with synthetic Northstar Studio data. Database provisioning, table queries, environment saves and connection results are illustrated, not executed. Password fields are empty; YOUR_DATABASE_PASSWORD is a symbolic placeholder. The interface and narration are English, with written guidance and selectable subtitles in six languages.
English audio · 5 min 9 sec · Subtitles in all six site languages.
1. Choose the site and database engine
Open the correct site, then Data, Databases. Check the hostname before choosing New database. A static website may not need a database. Your plan limits the number you can create, and your account needs permission to change the site.
Choose the engine your application supports. We use MySQL here. PostgreSQL is also offered, but its server and application driver must be available. Enable the optional vector extension only when the application requires it and your administrator has prepared the server.
Enter a database name and a dedicated username. They can be different. Our examples are northstar app and northstar user, with underscores. Use simple lowercase letters, numbers and underscores, and keep the username within the displayed thirty-two character limit.
| Engine | DB_CONNECTION | Local port example |
|---|---|---|
| MySQL | mysql | 3306 |
| PostgreSQL | pgsql | 5432 |
2. Store the password and create the database
Enter a strong password or use Generate password in the browser. Store it securely before submitting. Herne’s database record does not provide a password to retrieve later. Our screenshots deliberately leave this field empty; never copy a demonstration placeholder as your real password.
Review the site, engine, database name and username, then choose Create. Herne provisions the database and its dedicated account and links the record to this site. This does not automatically configure an existing application, create its tables, or import old data.
After creation, open the database name in the list. Confirm the engine and username in Database details. A new empty database normally has no application tables. The read-only browser lets you inspect tables later; it does not install your application’s schema.
3. Configure the application connection
For a Laravel application, open this site’s environment editor under Runtime. Set the connection, host, port, database name, username and your saved password. Our local MySQL example uses the loopback address and port thirty-three oh six. Preserve unrelated settings and the application key.
If you created PostgreSQL instead, use the PostgreSQL connection driver and its actual host and port. The conventional local port is fifty-four thirty-two. Keep the matching database and role names. Changing configuration does not convert an existing MySQL database or migrate its data.
Save the environment file, then clear stale Laravel configuration in this site’s Artisan runner. Enter config colon clear without the PHP Artisan prefix. If your deployment uses cached configuration or long-running workers, follow its rebuild and restart procedure before checking the application.
This example is for an application and database on the same server with the conventional local ports. Replace the names, endpoint and password with your own values. The password text below is not a usable credential. Preserve valid dotenv quoting when entering your actual password.
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=northstar_app
DB_USERNAME=northstar_user
DB_PASSWORD="YOUR_DATABASE_PASSWORD"
For a PostgreSQL database, replace the connection and port with the following local example, keeping that database’s actual name, role and password.
DB_CONNECTION=pgsql
DB_PORT=5432
If the application uses DB_URL, another environment source or custom config/database.php settings, review that configuration before editing. The six fields above may not be the effective connection. Change only this site application’s settings, never the Herne panel environment. For other frameworks, use their documented configuration format.
Laravel database configuration
In this site’s Artisan runner, enter only the command below. Rebuild configuration caches through your normal deployment procedure when required.
config:clear
4. Verify access and read usage labels
Use the application’s documented setup or migration procedure to create its tables when required. Confirm the intended database before any schema change. Then open an application page that needs the database. A panel database listing alone does not prove that the application can authenticate.
The Used by app badge matches the database name in the site’s environment file. It is not a successful connection test. Unknown usage needs investigation. Do not treat an Orphan badge as permission to delete: first check what still depends on that database.
5. Attach an existing database or rotate its password
If the database is already listed for this site, use that existing record. Attach existing database is for a pre-existing server database that is not already registered; it is not a second connection test for a managed record.
If the site already uses a local database, choose Attach existing database instead of creating another. Herne reads the connection and names from that site’s environment file and verifies the existing database, account and access. Attaching links the record; it does not import data or repair permissions.
Edit database changes the account password, not the database name or username. Leaving the field blank keeps the current password. If you rotate it, update the application’s saved password and configuration too, and coordinate the change to avoid interrupting requests and workers.
6. Troubleshoot and protect the data
For connection errors, check the selected engine, application driver, host, port, database name and username. Check the saved password privately and refresh stale configuration. Keep Herne’s own database credentials separate. If creation fails, inspect the reported cause before retrying or ask the administrator.
Review Database backups and the latest successful backup before important changes. An automatic schedule alone does not prove that a usable backup exists. Check the recorded result and follow the restore procedure for the matching database engine. We will cover backup and restore in the next guide.
Deleting a database permanently removes it and its dedicated account. Herne requires its exact name and blocks deletion when it is in use, primary, or its usage is unknown. Never delete a database just to troubleshoot a connection. Confirm dependencies and a recoverable backup first.
You now have a checklist for creating a site database and connecting an application: correct site and engine, separate names, securely stored password, matching application settings, and a real application check. Keep those connection details private. Next, prepare a backup and learn the recovery flow.