MySQL and MariaDB
Understand database credentials, imports, remote access, JDBC strings, connection testing, and backups.
Understand the credentials#
Your database provider supplies five separate values: hostname, port, database name, username, and password. The database host is not your website URL. If remote access is restricted, allow the bot host's outbound IP in the provider firewall or access list.
| Value | Example placeholder | Meaning |
|---|---|---|
| Host | YOUR_DATABASE_HOST | The network hostname supplied by the database provider. |
| Port | 3306 | The common MySQL port unless your provider supplies another. |
| Database | YOUR_DATABASE_NAME | The schema allocated to this bot. |
| User | YOUR_DATABASE_USER | The database login, not your hosting-panel username. |
| Password | YOUR_DATABASE_PASSWORD | The database user password. |
Import an SQL file#
- Create the database and a dedicated database user in the hosting panel.
- Grant that user access to the database.
- Open phpMyAdmin, select the database, choose Import, select the product SQL file, and run the import.
- Alternatively, use the MySQL command-line client with the exact database name supplied by the provider.
- Start the bot and check its console for a successful connection message.
mysql -u YOUR_DB_USER -p YOUR_DB_NAME < install.sqlRead a JDBC connection string#
If a provider supplies jdbc:mysql://mysql.example.com:3306/dmrelay, do not paste the entire value into DB_HOST. Use mysql.example.com as the host, 3306 as the port, and dmrelay as the database name. Enter the username and password separately.
Test and protect the database#
Connection failures commonly come from a wrong hostname, an incorrect database name, blocked remote access, invalid credentials, or a database user without permission. Back up the database before product upgrades and store backups separately from the live bot files.