Linux, Web Server & Database
Install MySQL on VPS
Get MySQL installed, secured and ready for your application on a fresh VPS.
The Problem
A default MySQL install leaves the root account insecure, no dedicated database or user for your application, and none of the memory/connection settings tuned for your VPS's actual resources.
About this problem
MySQL's own installer doesn't walk you through the basic hardening steps (removing anonymous users, disabling remote root login, setting a strong root password) unless you run the included secure-installation script afterwards, and plenty of fresh installs skip that step entirely.
This typically comes up when setting up a new application server that needs its own database, separate from a managed or shared hosting database.
What's Included
- Installing MySQL server and running the official security hardening script
- Creating a dedicated database and user for your application with least-privilege access
- Tuning key settings (innodb_buffer_pool_size, max_connections) against your VPS's RAM
- Confirming your application can connect successfully with the new credentials
What's NOT Included
- Migrating existing data from another server (see the database migration service)
- Setting up replication or clustering
- Ongoing database administration after initial setup
How It Works
- Install the MySQL server package and start the service.
- Run mysql_secure_installation to remove anonymous users, test databases and disable remote root login.
- Create a dedicated database and a user scoped only to that database, not global privileges.
- Adjust my.cnf settings (buffer pool size, max connections) to match the VPS's available RAM.
- Test a connection using the new credentials from the application side, not just the MySQL CLI.
In practice: you buy the service, send over whatever access or details the job needs, I investigate and do the work, and you confirm it's resolved before we call it done.
Frequently Asked Questions
- Should I use MySQL or MariaDB?
- They're closely compatible, and for most applications either works fine — MariaDB is the default on several distros now, while MySQL is still what many hosting panels and tutorials assume, so it often comes down to what your application specifically recommends.
- Why can't I connect to MySQL from my application?
- Common causes are the user not having privileges on the specific database, MySQL only listening on localhost when your app needs remote access, or a firewall blocking the port — each needs checking separately.
- Is it safe to use the root MySQL user for my application?
- No — a dedicated user with privileges limited to just its own database is standard practice, so a compromised application can't touch other databases on the same server.
- What does mysql_secure_installation actually do?
- It removes the anonymous user account, disables remote root login, removes the test database, and reloads privilege tables — all steps a fresh MySQL install leaves undone by default.
- How much RAM should I allocate to MySQL?
- As a rough starting point, innodb_buffer_pool_size is often set to around 50-70% of available RAM on a dedicated database server, but it should leave enough headroom for the OS and any other running services.
- Can I install MySQL and run a website on the same small VPS?
- Yes for small-to-moderate traffic, as long as memory settings are tuned sensibly so MySQL and the web server aren't competing for the same limited RAM.