Use your managed MariaDB (MySQL) database
Connect to MariaDB via CLI or GUI, create users, import a SQL dump and manage backups.
Use your managed MariaDB database
MariaDB is MySQL-compatible. Credentials (host, user, password, database) are in the panel’s Database tab.
1. Connect
Command line (mysql / mariadb)
mysql -h <host> -P 3306 -u <user> -p --ssl-mode=REQUIRED
Enter the password. --ssl-mode=REQUIRED forces TLS encryption.
GUI client (DBeaver, HeidiSQL, phpMyAdmin)
- Host: from the panel
- Port:
3306 - User / Password: from the panel
- SSL: enabled (required)
2. Allow your IP
Add your public IP under Database → Allowed IPs. Otherwise remote access is refused.
3. Common operations
-- Create a database and a dedicated user
CREATE DATABASE app_prod CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'app'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON app_prod.* TO 'app'@'%';
FLUSH PRIVILEGES;
-- Show active processes
SHOW PROCESSLIST;
4. Import / export
# Export (dump)
mysqldump -h <host> -u <user> -p --single-transaction <database> > backup.sql
# Import
mysql -h <host> -u <user> -p <database> < backup.sql
5. Backups
Automatic daily backups are managed by onesubnet. Also keep a regular dump (mysqldump) outside the infrastructure.
References
- MariaDB docs: https://mariadb.com/kb/en/documentation/
- mysqldump: https://mariadb.com/kb/en/mysqldump/