Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Self-Host MySQL on a VPS With Coolify

A practical guide to deploying MySQL as a Coolify resource on your VPS, using internal URLs, persistent volumes, scheduled S3 backups and safe restore and upgrade procedures.
Length10 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To self-host MySQL with Coolify, connect your VPS to the Coolify instance over SSH, create a MySQL resource in the correct project and environment, choose the connected server and Docker destination, review the generated credentials and URLs, and start the resource. Keep applications on Coolify’s private network and use the generated internal connection URL. Preserve the database volume at /var/lib/mysql, schedule mysqldump backups to S3-compatible storage, and test a restore before treating the deployment as reliable.

What Coolify is running on your VPS

Coolify is a self-hostable deployment platform. You provide the servers, and Coolify manages workloads on those servers. For MySQL, it creates and runs a Docker container on a selected connected server and Docker destination. The database is therefore part of your VPS workload, not a separate managed database service.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The arrangement has four relevant layers:

  • Coolify control plane: the Coolify instance from which you manage projects, environments, resources, deployments, backups and settings.
  • Connected server: your VPS, connected to Coolify over SSH and available as a workload target.
  • Docker destination and network: the place where the MySQL container and any application containers communicate.
  • Persistent volume: storage mounted into MySQL at /var/lib/mysql, kept separately from the container itself.

This separation matters when you redeploy. Replacing a container does not by itself delete data stored in the named volume. It also does not make that volume a backup: local storage remains tied to the deployment server unless you provide shared storage, and a damaged server can take both the running database and its local volume offline.

Prepare the VPS and Coolify project

Confirm the server connection

Coolify must be able to reach the VPS over SSH before it can create the database resource. In Coolify, add or select the server connection using the VPS address, SSH account and authentication details supplied by your provider. The server should appear as an available deployment target before you continue.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • 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.

Coolify’s normal lifecycle is to connect a server, create a resource, build or pull an image, start Docker containers and route traffic when routing is required. MySQL uses that same lifecycle, with the database container and its storage managed as a resource in your project.

Choose the project, environment and destination

Open the Coolify project and environment that will own the database. Select the connected VPS and the Docker destination where the application that will use MySQL runs, when possible. Keeping both resources on the same destination makes the private network connection straightforward and avoids exposing the database merely to let your own application reach it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Plan storage and access before starting

  • Decide which application or applications will use this MySQL resource.
  • Identify whether any client outside the Coolify network genuinely needs database access.
  • Confirm that your VPS has storage appropriate for the database and its backup process. The reviewed Coolify documentation does not publish a universal CPU, memory, disk or bandwidth minimum; those requirements depend on workload, data size and query behavior.
  • Choose an off-site, S3-compatible destination for backups so a VPS failure does not also remove your only backup copy.

Create the MySQL resource in Coolify

  1. In the selected project and environment, choose New Resource → MySQL.
  2. Select the connected VPS and the Docker destination.
  3. Review the generated image, root password, normal-user credentials, initial database and connection URLs before starting anything.
  4. Select Start and wait for the container to become healthy in Coolify.

Coolify documents these defaults for the MySQL resource:

Setting Documented default
Image mysql:8
Internal port 3306
Normal user mysql
Initial database default
Data mount /var/lib/mysql
Root password Generated when the resource is created
Normal-user password Generated when the resource is created

Save the generated credentials in your secret-management process. Treat the root password as an administrative secret and use the normal application credentials for routine application connections.

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • 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

Connect an application to the database privately

Use the generated internal URL

An application running on the same Coolify destination network should use the internal URL shown by the MySQL resource. The documented pattern is:

mysql://<user>:<password>@<database-container>:3306/<database>

Put that value in the application’s environment-variable configuration, using the variable name expected by the application or framework. Replace the placeholders with the generated normal user, password, database-container name and database name. The database-container portion is a Docker-resolvable service name supplied by Coolify; do not replace it with the VPS’s server IP for an internal connection.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep the application and database on the same network

The private URL works when the application container and MySQL container share the relevant Coolify destination network. If the application is deployed elsewhere, first decide whether moving it onto the same destination is practical. Exposing MySQL publicly just to bridge two resources is a broader attack surface and should not be the default solution.

Validate the connection without publishing MySQL

After adding the environment variable, redeploy or restart the application using its normal Coolify workflow. Check the application logs for a successful database connection and verify that it can create or read the expected schema. A failed connection should be diagnosed by checking the URL, credentials, database name, container name and shared network before changing firewall rules.

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • 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)

When public MySQL access is justified

Keep MySQL private unless an external client, migration tool or separate service genuinely requires a connection from outside the Coolify network. If you must provide that access:

  1. Enable Coolify’s public TCP proxy for the MySQL resource.
  2. Expose only the required proxy port and restrict it with the VPS or provider firewall to known source addresses whenever possible.
  3. Use SSL where the client and MySQL configuration support it.
  4. Give the external client the public connection details, not the internal container name.
  5. Disable the public route when the external task is complete.

A public TCP proxy is an access path, not an authorization system. Continue to use least-privilege database accounts, strong generated secrets and firewall restrictions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Understand persistent storage

Coolify mounts MySQL’s data directory at /var/lib/mysql in a named Docker volume. The volume is separate from the running container, so recreating or redeploying the container does not normally remove data stored there.

That protection has limits:

  • Deleting the volume, intentionally or accidentally, deletes the database data in it.
  • A local volume remains on the VPS. Loss of that server, its disk or its Docker storage can make the database unavailable.
  • Persistent storage is not a database-aware backup. It does not provide historical versions, point-in-time recovery or a tested way to rebuild on another server.

Use the volume for live durability through ordinary container lifecycle operations, and use database dumps stored elsewhere for recovery.

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • 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

Configure scheduled MySQL backups

Choose what to dump

Coolify uses mysqldump for scheduled MySQL backups. The backup configuration lets you select specific databases or all databases. All-database dumps are gzip-compressed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set schedule, retention and destination

  1. Open the database backup area in Coolify and choose Database backups.
  2. Select the MySQL resource and choose the databases to include, or select all databases.
  3. Set the backup schedule appropriate for the amount of data you can afford to lose between successful runs.
  4. Set retention so older dump files are removed according to your storage and recovery policy.
  5. Configure an S3-compatible storage destination and confirm that Coolify can write to it.
  6. Run or wait for a backup, then verify that an object was created in the remote bucket.

The schedule and retention values are operational choices, not universal guarantees. Your achievable recovery point and recovery time depend on how often dumps complete, how quickly they can be downloaded and restored, and whether the destination remains available.

Make backups useful

  • Keep backup storage separate from the VPS that runs MySQL.
  • Restrict bucket credentials to the permissions needed for the backup path.
  • Monitor for failed jobs and unexpectedly small or missing dump files.
  • Keep at least one copy that your normal cleanup policy will not immediately remove if you need longer-term protection.
  • Test restoration on a separate resource; a file that exists is not proof that it can be restored.

Restore a backup safely

Coolify’s Import Backup form can restore a MySQL backup while the database is running. Restoration replaces data in the target resource, so treat it as a destructive operation even when the form does not require you to stop the container.

  1. Stop application writes. Put the application into maintenance mode or otherwise prevent jobs, users and workers from changing the target database.
  2. Identify the exact Coolify MySQL resource that should receive the restore. Check the project, environment, server and database name.
  3. Preserve a separate copy of any data that must not be replaced. Create a fresh dump of the target when its current contents may be needed for rollback.
  4. Open the MySQL resource’s Import Backup form and select the intended backup.
  5. Start the import and monitor the operation until it finishes.
  6. Check the restored schema and representative application data before allowing writes again.
  7. Resume the application and verify that it connects with the expected credentials and database name.

Do not use a production restore as your first restore test. A separate test resource lets you confirm that the dump, compression, credentials and destination are all usable without replacing live data.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • 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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Manage MySQL image upgrades

Match the MySQL image to the application and to the tools used to back up and restore it. The default resource image is mysql:8, but changing image versions can alter SQL behavior, authentication defaults, system tables and compatibility.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Take a fresh backup and verify that it can be read.
  2. Create a test copy of the data or restore the backup to a separate MySQL resource.
  3. Apply the proposed image version to the test resource.
  4. Run the application’s migrations, connection checks and important queries against the test copy.
  5. Review errors and compatibility issues before scheduling the production change.
  6. Back up production again immediately before the upgrade.
  7. Upgrade production during a maintenance window, then verify application health and database access.

Keep the pre-upgrade backup until the new version has passed your validation period. Do not assume that a container restart alone constitutes a safe major-version migration.

One-click MySQL or Docker Compose?

Coolify’s one-click MySQL resource is appropriate for a standard, single MySQL deployment. Docker Compose is the better fit when you need a custom topology or an engine configuration that the one-click resource does not expose.

Decision axis Coolify MySQL resource Docker Compose deployment
Manual configuration Lower: choose the resource, server and destination, then review generated settings. Higher: define the service, environment, network and storage configuration yourself.
Topology flexibility Designed for a standard single MySQL resource. Suitable when a custom topology or additional services are required.
Persistent storage Coolify creates and manages the database volume and mount. You declare the required volumes and mounts in Compose.
Backup workflow Built-in scheduled mysqldump configuration, retention and S3-compatible destination settings. You must design and operate the dump, scheduling, retention and remote-storage workflow.
Upgrade control Image changes are managed through the resource, with testing still required. You control the Compose image and related service changes directly.
Network exposure Private internal URL by default, with an optional public TCP proxy. You define published ports and network rules yourself, while still needing firewall controls.

Compose does not remove the operational responsibilities: the volume still needs protection, backups still need testing, and a published port still needs restriction.

Troubleshoot common connection and recovery problems

The application cannot resolve the database host

  • Confirm that the application and MySQL are on the same Coolify destination network.
  • Use the database container name from the generated internal URL, not a VPS IP address.
  • Check that the MySQL resource has started successfully before restarting the application.

Authentication fails

  • Copy the generated normal-user password again; avoid accidentally using the root password in the application.
  • Confirm the username and database name in the environment variable.
  • Restart or redeploy the application after changing its secret so the new value is loaded.

An external client cannot connect

  • Verify that public TCP proxy access is enabled only on the intended resource.
  • Check the VPS or provider firewall for the proxy port and source address.
  • Use the public endpoint for the external client; internal container names are not public DNS names.
  • Confirm that the client’s SSL settings match what the database endpoint supports.

A restore appears to have missing data

  • Confirm which databases were selected when the dump was created.
  • Remember that all-database dumps are compressed and must be imported through the appropriate backup workflow.
  • Check that the restore targeted the intended project, environment and MySQL resource.
  • Review the import result and application schema migrations before concluding that the dump is incomplete.

The database disappeared after a redeploy

  • Check that the original named volume is still attached to the resource.
  • Verify that the mount remains /var/lib/mysql.
  • Do not delete or recreate volumes while troubleshooting unless you have a verified external backup.
  • If the VPS storage itself failed, recover by creating a replacement resource and importing a dump from remote storage.

Operational checklist

  • SSH connectivity from Coolify to the VPS works.
  • The MySQL resource is in the intended project and environment.
  • The selected server and Docker destination are correct.
  • Generated credentials are stored securely.
  • The application uses the internal URL and database container name.
  • MySQL remains private unless an external client requires the public TCP proxy.
  • The VPS/provider firewall limits any exposed proxy port.
  • The /var/lib/mysql volume is present and has adequate storage for the workload.
  • Scheduled mysqldump jobs write to S3-compatible storage.
  • Retention is configured and failed backups are noticed.
  • A restore has been tested on a separate resource.
  • Major MySQL image changes are tested against a copy before production.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.