Hosting a database at home for a pet project

Viewed 325

I am working on a pet project which may or may not be used by anyone depending on how good or bad it turns out to be. I am currently running a MySQL instance on a cloud provider and even though I am hardly using that instance or even have any data in it, I have come to realize that databases are not cheap. I spend about $20/month on AWS for hardly using anything. I am trying to see if I can just run a MySQL Server at home and get my job done with it with a static IP till the app is ready for prime time. I do need a static IP because my application is hosted on stuff like Vercel and Heroku and they will need to talk to the database. Also, would there be any security risks if I just open the MySQL port up on one of the machines at home running MySQL Server?

1 Answers

I run MySQL on my home machine all the time. I have, a couple of times, opened up a port in my router/firewall to give external access. It's pretty doggone slow, but it works.

You'll be smart to use some oddball randomly chosen port number rather than 3306 if you do that. Slows down the cybercreeps and script kiddies.

If I were you I'd be very careful about storing confidential or irreplaceable data on any MySQL instance that's wide open to the public 'net. ("Very careful" === don't do it.) You should consider creating host-specific accounts on your MySQL, for example,

CREATE USER 'herokuApp'@'192.0.2.123' IDENTIFIED BY 'REDACTED';

where 192.0.2.123 is the IP address of your Heroku dyno. Give that user the minimal privileges necessary to make things work and do your management from your own environment or machine.

You know, Heroku's postgreSQL service has a free tier. Maybe that's a good way to go?

Another possible choice: stand up your own MySQL server on a $5 / month VM on AWS, DigitalOcean, or somewhere. Not free, but cheaper.

And, read this: Mysql adding user for remote access

Related