Table of Contents

MySQL - Getting Started Guide

MySQL is the world’s most popular open-source relational database, used by millions of applications from small websites to large-scale enterprise systems. This server comes with MySQL 8.4 LTS fully configured with the root password you specified during the order. phpMyAdmin is included for web-based database management.


Step 1 – Verify MySQL Works

Your server’s IP address and root password are shown in the Server Information section on the Overview tab of your server in the client portal. The application settings you entered when ordering, passwords included, are shown in the MySQL Credentials card on the same tab. phpMyAdmin is available immediately after your server is created. Open https://your.server.ip/phpmyadmin in a browser to verify it works.

HTTPS without a domain. Since January 2026 Let’s Encrypt issues certificates for IP addresses (official announcement), so your server gets a real, browser-trusted certificate on first boot – before you connect any domain. Certificates of this kind are short-lived (about six days) and renew automatically. If your server is not reachable from the internet on port 80 (for example, it sits behind a router), the certificate cannot be issued – in that case the browser shows a warning for a self-signed certificate – accept it, or use http:// instead.

phpMyAdmin login:

  • Username: root
  • Password: the MySQL Root Password you entered during the order

With phpMyAdmin you can create databases, run SQL queries, import/export data and manage users without using the command line.

Database servers don’t need public internet access. For secure access, place the server on a private network behind a VyOS router and connect through a VPN on the router (WireGuard or OpenVPN, on the router’s Configuration tab) to reach MySQL and phpMyAdmin on the server’s private IP. On a private address the server does not get the IP certificate, so open phpMyAdmin over http:// there – the VPN already encrypts the connection.

Firewall. If you turn on the Firewall for this server in the client portal, allow incoming TCP port 80 in its rules, along with 443 for phpMyAdmin. Certificates renew over port 80 – the IP certificate every few days – and without that rule the certificate expires and the browser starts showing a warning.


Step 2 – Connect to MySQL Remotely

MySQL accepts remote connections on port 3306, but the root account works only on the server itself (phpMyAdmin and SSH) – remote root login is disabled for safety. For applications and database tools, create a separate user. Connect via SSH and run:

ssh root@your.server.ip
mysql -u root -p
CREATE DATABASE appdb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'appuser'@'%' IDENTIFIED BY 'strong_password';
GRANT ALL PRIVILEGES ON appdb.* TO 'appuser'@'%';

'%' allows connections from any address. To allow only your own address, use it instead, for example 'appuser'@'203.0.113.10'. Users can also be created in phpMyAdmin on the User accounts tab. Then connect from your computer or application:

mysql -h your.server.ip -u appuser -p

Connection details for database GUI tools (MySQL Workbench, DBeaver, HeidiSQL, etc.):

Parameter Value
Hostyour.server.ip
Port3306
Usernamethe user you created (appuser in the example)
Passwordthat user’s password

Note: Port 3306 is MySQL protocol, not HTTP – it cannot be opened in a browser. Use a database client or the command above.


Step 3 – Enable SSL for phpMyAdmin (Optional)

If you have a domain pointing to this server, you can enable HTTPS for phpMyAdmin with a free Let’s Encrypt certificate. Connect via SSH and run:

ssh root@your.server.ip
/opt/setup/get-ssl.sh db.yourdomain.com

The script will verify DNS, obtain a certificate and configure Apache for HTTPS automatically. After completion, phpMyAdmin is available at https://db.yourdomain.com/phpmyadmin.

Note: Make sure your domain’s A record points to the server IP before running the script. SSL is optional – phpMyAdmin works fine over HTTP with IP address access.


Database Management

Creating Additional Databases

You can create additional databases via phpMyAdmin or SSH:

mysql -u root -p

CREATE DATABASE newdb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'newuser'@'%' IDENTIFIED BY 'strong_password';
GRANT ALL PRIVILEGES ON newdb.* TO 'newuser'@'%';
FLUSH PRIVILEGES;

Import and Export

Via phpMyAdmin: Use the Import/Export tabs – supports SQL, CSV, and other formats. Max upload size is 64 MB.

Via command line:

# Export
mysqldump -u root -p your_database > backup.sql

# Import
mysql -u root -p your_database < backup.sql

For large databases (over 64 MB), use the command line instead of phpMyAdmin.


Post-Installation

Fail2Ban – Brute-Force Protection

Your server comes with Fail2Ban pre-configured to protect both SSH and phpMyAdmin from brute-force attacks.

Rule Max Attempts Ban Duration
SSH5 failed logins10 minutes
phpMyAdmin5 failed logins1 hour

Useful commands:

# Check banned IPs
fail2ban-client status phpmyadmin
fail2ban-client status sshd

# Unban an IP
fail2ban-client set phpmyadmin unbanip 1.2.3.4

If you accidentally lock yourself out, open the Console on your server’s Overview tab in the client portal and unban your IP.

Service Management

MySQL and the web stack run via systemd. Common commands:

# Check service status
systemctl status mysql
systemctl status apache2

# Restart MySQL
systemctl restart mysql

# View MySQL logs
journalctl -u mysql -n 100

MySQL Performance Tuning

InnoDB buffer pool is automatically set to 50% of RAM on first boot. To check the current value:

mysql -u root -p -e "SHOW VARIABLES LIKE 'innodb_buffer_pool_size';"

To adjust manually, edit /etc/mysql/mysql.conf.d/99-tuning.cnf and restart MySQL:

systemctl restart mysql

Server Credentials

MySQL root password is stored in /root/.mysql_credentials.

What’s Pre-Configured

  • Remote access: MySQL accepts connections from any IP on port 3306 for users you create; root is limited to the server itself
  • InnoDB buffer pool: Automatically tuned to 50% of available RAM on first boot
  • Performance schema: Disabled on servers with less than 2 GB RAM to save resources
  • PHP uploads: 64 MB max file size (for phpMyAdmin imports)

Software Included

Component Version
Ubuntu24.04 LTS
MySQL8.4.13 LTS (Oracle APT)
Apache2.4
PHP8.3
phpMyAdmin5.2.1
Certbot5.8 (IP address), 2.9 (domain)
Fail2Ban1.0

Troubleshooting

Problem Solution
Can’t connect to MySQL remotely (“Host … is not allowed to connect”) root cannot log in remotely by design – create a separate user as shown in Step 2. For your own user, check that its host is '%' or your IP (not 'localhost') and that port 3306 is not blocked by a firewall
phpMyAdmin shows “configuration storage is not completely configured” This is a notice, not an error: optional extras such as bookmarks and query history are off, all database work is available. phpMyAdmin itself offers a link to set them up
phpMyAdmin shows login error Verify your MySQL password. Root credentials are in /root/.mysql_credentials
phpMyAdmin import fails (file too large) Max upload is 64 MB. For larger files, use mysql -u root -p dbname < file.sql via SSH
MySQL won’t start Check logs: journalctl -u mysql -n 50. Common cause: disk full (df -h /)
Forgot MySQL root password SSH in and check /root/.mysql_credentials
Blocked by Fail2Ban Use the Console on your server’s Overview tab in the client portal to unban your IP
Forgot root password Use the Console on your server’s Overview tab in the client portal to reset it