To enable remote MySQL access safely, configure four controls in order: make MySQL listen on the VPS address you actually need, create a MySQL account whose host matches the connecting computer, allow TCP 3306 only through the VPS and provider firewalls for trusted sources, and encrypt the connection with TLS or an SSH tunnel. Opening port 3306 alone is not sufficient and can expose the database to unauthorized traffic.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
For a few administrators, an SSH tunnel usually provides the smallest attack surface because MySQL can remain private on the VPS. For an application fleet that must connect directly, use a specific listener address, tightly scoped firewall rules, a dedicated least-privileged account, and TLS.
As an Amazon Associate I earn from qualifying purchases.
Free tools Windows power users keep installed
One-click scans. No signup required.
What remote access to MySQL actually requires
A remote connection succeeds only when every layer in the path agrees. MySQL must bind to an interface reachable from the client; the account must be authorized for that client host; network firewalls must pass the traffic; and the data stream must be protected against interception on any untrusted network. A failure at any one layer can look like a generic timeout or “access denied” error, so treat setup as a chain rather than a single port-opening task.
- Listener: the
bind-addressoption determines which VPS interfaces accept TCP connections. - Authentication: MySQL matches both the username and the connecting host, so
'appuser'@'localhost'is different from'appuser'@'203.0.113.25'. - Network policy: TCP 3306 must be permitted by the VPS operating-system firewall and by the hosting provider’s firewall or security group.
- Transport security: use MySQL TLS for direct access or carry the connection through an encrypted SSH tunnel.
Oracle’s MySQL security guidance describes this model as access control lists governing connections, queries, and other operations. A successful TCP handshake does not grant database privileges; it only reaches the authentication stage.
#1 Best Overall
- BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
- EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
- COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
- LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
- WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
Plan the connection before changing the VPS
Record the two endpoints
Write down the VPS address that should receive the connection and the client’s source address. A private address on the same private network is preferable. If the client must use the public Internet, use a fixed public source address or the smallest practical CIDR range instead of allowing every IPv4 or IPv6 address. Also record whether the client will connect directly with TLS or through SSH.
Use the VPS interface address that corresponds to the intended path. A server may have loopback, private, public IPv4, and one or more IPv6 addresses. Binding to the wrong one can make MySQL appear offline even though the service is running.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Decide whether direct access is necessary
Direct access is appropriate when several application servers or a managed service need to reach MySQL continuously. It requires certificate handling, stable source-address rules, and a publicly or privately reachable database port. An SSH tunnel is generally better for occasional administration or a small trusted team: the database can listen only on loopback or a private interface, while SSH exposes the authenticated entry point.
Configure MySQL to listen on the required address
Find the distribution’s option file
On Ubuntu installations, Canonical documents /etc/mysql/mysql.conf.d/mysqld.cnf as a common MySQL configuration path. Other Linux distributions, images, and MariaDB-based packages may use a different included file. Confirm which file is read by the installed package before editing it, and make a backup so the previous working configuration can be restored.
Set a specific bind-address
Under the [mysqld] section, set bind-address to the VPS address that should accept connections. An example for a documentation-only IPv4 address is:
[mysqld]
bind-address = 192.0.2.24
Replace the example with the VPS interface address on your own network. A specific address limits MySQL to that path. Binding to a wildcard makes MySQL listen on every available interface, which is easier to configure but increases exposure and may unintentionally publish the service on a public interface. Use a wildcard only when every listening interface is deliberately protected by network policy.
Recommended Free Tools
For IPv6, use the server’s IPv6 address in the format supported by your MySQL version and operating-system configuration. Do not assume that an IPv4 listener also accepts IPv6 connections; treat the two address families as separate paths and firewall rules.
Rank #2
- WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
- AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
- PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
- ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
- COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
Restart the correct service
The unit name varies by distribution and VPS image, so do not blindly run one universal restart command. Identify the installed unit first:
systemctl list-units --type=service | grep -Ei 'mysql|mariadb'
Restart the unit shown by your system, then check its status and recent journal output. If the service fails to start, inspect the option-file syntax, duplicate bind-address entries, and whether another process already occupies the configured port. Restore the backup if necessary, correct the file, and restart again before changing firewall rules.
Create a host-qualified, least-privileged account
Do not expose root for application traffic
Create a separate account for the remote workload. MySQL’s account name includes a host component, so the host restriction is part of authentication rather than an optional annotation. Avoid granting remote access to a broadly permitted root account; a stolen application credential should not become unrestricted server access.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Restrict the account to the expected source
Connect locally as an administrative account and create a user tied to the client’s address. This pattern uses a documentation-only IPv4 address and an example secret:
CREATE USER 'appuser'@'203.0.113.25'
IDENTIFIED BY 'use-a-long-unique-secret';
Grant only the database and operations the application requires. For example, an application that uses one schema should receive privileges on that schema rather than global privileges. Keep the password unique to this account and store it in the application’s secret manager or protected configuration, not in a public repository.
If the client comes from a controlled subnet, use the narrowest host or network expression that still accommodates the real clients. Avoid a host value that effectively permits every Internet address. For IPv6, create an account whose host value matches the IPv6 source as MySQL expects; Oracle’s IPv6 example demonstrates host-specific account creation and checking the account selected for a connection.
Verify which account MySQL selected
After connecting, run SELECT CURRENT_USER(); to see the authenticated MySQL account, including its host portion. This catches a common mistake in which a more specific or more general account matches instead of the one you intended. Review grants for the account and remove unused privileges rather than compensating for a mismatch by opening the network to more hosts.
Rank #3
- Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
- Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
- Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
- ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
- Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
Allow TCP 3306 only for trusted sources
Configure the VPS firewall
Permit TCP 3306 from the exact client address or private network. With UFW, an illustrative rule is:
sudo ufw allow from 203.0.113.25 to any port 3306 proto tcp
Replace the example address with the real source. If several application servers connect, create separate narrowly scoped rules or use the provider’s private network range. Do not use an unrestricted rule such as allowing 3306 from anywhere unless there is an exceptional, documented reason and compensating controls.
Check the active firewall rules after adding the exception. Ensure that a broad earlier rule is not defeating your intended restriction and that IPv6 filtering is enabled if IPv6 is in use.
Configure the hosting provider firewall
Most Linux VPS platforms have a second firewall, often called a security group, cloud firewall, or network ACL. Add an inbound TCP rule for port 3306 with the same source restriction used on the VPS. A rule in only one layer will not produce a working connection, while a permissive rule in either layer can expose the database.
Keep SSH management rules separate from MySQL rules. If you later move to an SSH tunnel or private network, remove the public 3306 rule from both the provider firewall and the VPS firewall instead of leaving an obsolete exception in place.
Understand why public 3306 is risky
Oracle’s security checklist advises that port 3306 should not be accessible from untrusted hosts and that an exposed port should be closed when there is no good reason to leave it open. Bitnami similarly warns that making database application ports public is a significant security risk. Network restriction reduces the number of systems that can even attempt authentication; it does not replace strong passwords, account privileges, or encryption.
Protect the connection with TLS or SSH
Direct connections with MySQL TLS
For direct application access, configure MySQL server certificates and keys according to the version and Linux package you run, install the appropriate CA certificate on clients, and require clients to negotiate TLS. MySQL’s secure deployment documentation describes binding to a specific address and configuring secure connections; its security guidance says not to transmit unencrypted data over the Internet.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Rank #4
- Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
- Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
- 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
- Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
- USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
Consider enabling MySQL’s require_secure_transport setting after TLS clients are ready. Test every client first: turning on a secure-transport requirement can intentionally reject legacy clients that connect without encryption. Record the certificate authority, server-name validation setting, renewal process, and which application connection options enforce certificate verification.
SSH local forwarding
An SSH tunnel keeps MySQL private on the VPS and forwards a local client port through an authenticated SSH session. On the administrator’s computer, run:
ssh -N -L 13306:127.0.0.1:3306 [email protected]
Leave that session running. The first address and port (13306) are local; the final address and port (127.0.0.1:3306) are evaluated on the VPS. Then point the MySQL client at the local endpoint:
mysql -h 127.0.0.1 -P 13306 -u appuser -p
Because the database sees the forwarded connection as originating locally, create the account host component appropriate for the connection path you have configured and verify it with CURRENT_USER(). Protect the SSH account with key-based authentication, limit its privileges, and monitor tunnel use. An SSH tunnel encrypts the forwarded TCP stream, but it does not automatically secure other clients or make a public 3306 rule necessary.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteDirect TLS or SSH tunnel: which fits your use case?
| Decision factor | Direct MySQL over TLS | SSH local tunnel |
|---|---|---|
| Database port exposure | TCP 3306 is reachable on a private or public interface, but firewall rules must restrict sources. | MySQL can remain on loopback or a private interface; no public database port is required. |
| Typical client population | Many application servers or continuously running services. | A few administrators or occasional trusted connections. |
| Credential and key management | MySQL accounts plus CA/server certificate distribution and renewal. | SSH keys and accounts, with MySQL credentials still required. |
| Source-address stability | Stable client addresses simplify account and firewall restrictions. | Administrators connect through the VPS’s SSH policy; local client addresses do not need database firewall rules. |
| Operational complexity | Higher initial TLS and certificate setup, then suitable for automated clients. | Simple for humans, but each session or automation job must maintain the tunnel. |
| Auditability | Database logs show direct client network paths and MySQL accounts. | SSH logs identify the tunnel user; correlate them with MySQL connection logs. |
Choose the option that matches the client population rather than opening both paths by default. If an SSH tunnel satisfies the requirement, close public 3306 and bind MySQL only to the interface the tunnel uses.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Connect and verify from the client
Test a direct connection
From an approved client, use the server address, port, and dedicated account:
mysql -h <server-address> -P 3306 -u appuser -p
Once connected, check the client status, run SELECT CURRENT_USER();, and perform only a harmless query against the intended schema. Confirm that the connection negotiated TLS when direct encryption is required. On the VPS, review MySQL’s error log for rejected hosts, TLS failures, authentication errors, or startup binding messages.
Best Value
- Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
- Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
- Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
- Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
- Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
Test an SSH-tunneled connection
Start the tunnel and connect to the local forwarded port:
mysql -h 127.0.0.1 -P 13306 -u appuser -p
If this works while a direct connection fails, the database and account are probably healthy and the remaining issue is the direct listener or firewall path. If the tunnel fails, verify SSH reachability and authorization first, then confirm that MySQL is listening on the tunnel’s destination address.
Interpret common failure symptoms
| Symptom | Likely layer | Checks |
|---|---|---|
| Connection timed out | Routing or firewall | Confirm the client source address, provider rule, VPS firewall rule, destination address, and port. |
| Connection refused | Listener or service | Check that MySQL is running, the configured unit restarted successfully, and bind-address matches the address used by the client. |
| “Host … is not allowed” | MySQL account host matching | Inspect the account’s host component, the client’s actual source address, and the result of CURRENT_USER(). |
| “Access denied for user” | Credentials or privileges | Reset the dedicated account password if necessary, verify the username and host-specific account, and review grants. |
| TLS or certificate error | Transport security | Check CA trust, server-name validation, certificate expiry, client TLS options, and whether a secure-transport requirement rejects the client. |
| IPv4 works but IPv6 fails | Address family configuration | Check the IPv6 listener, IPv6 firewall rule, DNS result, routing, and the IPv6-specific MySQL host account. |
IPv6, DNS, and changing client addresses
DNS names can resolve to different addresses over time. If the account and firewall are tied to one fixed IPv4 address but the client begins using another address or IPv6, authentication or network access will fail even though the hostname is unchanged. Decide whether to pin the client to a stable address, update rules as part of deployment, or use a private network whose addressing is controlled.
When troubleshooting, test the address family actually selected by the client. A hostname that returns both records may use IPv6 first, exposing a missing IPv6 firewall rule or account while IPv4 appears correctly configured. Keep IPv4 and IPv6 rules equally restrictive.
Remove exposure and maintain the setup
After the first successful test, perform a cleanup pass rather than treating connectivity as the end of the task:
- Remove temporary firewall rules and any public 3306 exception no longer needed.
- Bind MySQL to the narrowest required interface instead of a wildcard.
- Delete unused remote accounts and revoke privileges that exceed the application’s needs.
- Rotate the dedicated password and SSH keys according to your operational policy.
- Renew TLS certificates before expiration and verify that clients still validate the intended CA and server name.
- Review MySQL, SSH, VPS firewall, and provider-firewall logs for unexpected source addresses or repeated authentication failures.
- Document the approved client addresses, account hosts, transport choice, and rollback procedure for future administrators.
Oracle recommends encrypted protocols and restricting access to trusted hosts. Recheck those assumptions whenever the VPS address, client network, provider firewall, database version, or application topology changes.
Quick Recap
A safe end-to-end sequence
- Choose a private path or record the exact trusted client address and decide between direct TLS and SSH.
- Back up the MySQL option file and set
bind-addressto the required VPS interface. - Restart the distribution’s actual MySQL service unit and confirm it remains healthy.
- Create a dedicated host-qualified account with a long unique secret and minimum required privileges.
- Allow TCP 3306 only from the approved source in both the VPS and provider firewalls, or keep 3306 private when using SSH.
- Configure and test TLS for direct access, or start the SSH local forward for administrative access.
- Connect with the appropriate
mysqlcommand, check status andCURRENT_USER(), and inspect logs. - Close temporary or unnecessary exposure and record the final configuration.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




