Skip to main content
Pterodactyl Panel requires a MySQL (8.0+) or MariaDB (10.2+) database to store panel data.

Basic Configuration

Database Connection

.env
string
default:"mysql"
Database driver to use. Options: mysql, mariadb
Both drivers work with MySQL and MariaDB. The mariadb driver enables MariaDB-specific optimizations.
string
default:"127.0.0.1"
Database server hostname or IP address.
integer
default:"3306"
Database server port.
string
default:"panel"
Name of the database to use.
string
default:"pterodactyl"
Database user with access to the panel database.
string
required
Database user password.
Use a strong, randomly generated password for production environments.

Advanced Configuration

Unix Socket Connection

For local databases, Unix sockets provide better performance than TCP:
.env
string
Path to MySQL/MariaDB Unix socket file. When set, this takes precedence over DB_HOST and DB_PORT.

Database URL

Alternatively, use a database URL for configuration:
.env
string
Full database connection URL. Overrides individual connection parameters.

Character Set & Collation

.env
string
default:"utf8mb4"
Character set for database connections.
Do not change this unless you know what you’re doing. utf8mb4 is required for full Unicode support.
string
default:"utf8mb4_unicode_ci"
Collation for character comparisons and sorting.

Table Prefix

.env
string
Prefix for all database tables. Useful when sharing a database with other applications.

Timezone Configuration

.env
string
MySQL timezone offset. Automatically calculated from APP_TIMEZONE if not set.
The Panel automatically converts APP_TIMEZONE to a MySQL-compatible offset.

Strict Mode

.env
boolean
default:"false"
Enable MySQL strict mode for stricter SQL validation.
Currently defaults to false for compatibility. Future versions may default to true.

SSL/TLS Configuration

Secure your database connection with SSL/TLS encryption.

Basic SSL

.env
string
default:"prefer"
SSL connection mode. Options:
  • prefer - Use SSL if available, otherwise unencrypted
  • require - Require SSL connection
  • verify-ca - Require SSL and verify CA certificate
  • verify-full - Require SSL and verify certificate identity

Advanced SSL Configuration

For certificate-based authentication:
.env
string
Path to Certificate Authority (CA) certificate file.
string
Path to client certificate file.
string
Path to client private key file.
boolean
default:"true"
Verify the server’s SSL certificate.
Only disable for testing with self-signed certificates. Always enable in production.

Database Setup

Creating the Database

  1. Log into MySQL/MariaDB:
  2. Create the database and user:

Running Migrations

After configuring the database connection, run migrations:
The --seed flag populates the database with default data, and --force is required in production.

Remote Database Configuration

Connecting to Remote MySQL/MariaDB

.env
Always use SSL/TLS when connecting to remote databases to encrypt traffic.

Firewall Configuration

Ensure your database server allows connections from the Panel server:

MySQL User Permissions

For remote connections, create the user with the Panel server’s IP:

Performance Optimization

Connection Pooling

Laravel automatically manages connection pooling. No additional configuration needed.

Query Optimization

Enable query logging during development to identify slow queries:

Testing the Connection

Verify your database connection:
This command will fail if the database connection is misconfigured.

Connection Test Script

Troubleshooting

Possible causes:
  • MySQL/MariaDB service is not running
  • Incorrect DB_HOST or DB_PORT
  • Firewall blocking connections
Solutions:
Possible causes:
  • Incorrect username or password
  • User doesn’t have permissions for the database
  • User host restriction mismatch
Solutions:
Possible causes:
  • MySQL not configured for SSL
  • Invalid certificate paths
  • Certificate verification failures
Solutions:
Symptoms:
  • Emoji or special characters not displaying correctly
  • Database errors related to character encoding
Solution:

Security Best Practices

Strong Passwords

Use randomly generated passwords with at least 32 characters for database users.

Restrict User Access

Grant database users only the permissions they need, and restrict by host.

Use SSL/TLS

Enable SSL/TLS for all database connections, especially for remote databases.

Regular Backups

Implement automated database backups with point-in-time recovery capabilities.

Supported Database Versions

Minimum Requirements:
  • MySQL 8.0 or higher
  • MariaDB 10.2 or higher
Recommended:
  • MySQL 8.0.34+
  • MariaDB 10.11+ (LTS)