MySQL in roblox?

Hello! I want to know a way to connect to a MySQL server on Roblox. Is there a way? And if I need to use a third party to be able to connect to the server, can you please reference a guide for it? Thanks!

1 Like

Do you own the MySQL database?

If so, you’ll need to add an HTTP server and API to it. I found this article for doing it with NodeJS which is probably easiest, but you could use any language to host. I won’t go into the details of how to host an application on the web for your game to access, because there’s lots of info online and it’s involved. I’m also not an expert in this :slight_smile:

If you don’t own the database, is there a HTTP API you can use? Or otherwise how do you make updates to it?

Either way, once you have an HTTP API you can interface with it using HttpService | Roblox Creator Documentation.


Thank you for answering! I have another question. I already have a MySQL Database with the IP, User, Password etc… so everything is set up. But how do I connect to it, using Roblox Lua? Can you tell me where to start?


You can’t directly connect to the database from roblox, if that’s what you mean.

The only external connections you can make from Roblox are all HTTP (like web requests)—that’s why I talked about setting up an HTTP API interface.

So your game in Roblox would talk to that web server API (maybe it’s running on node or something) via HttpService.

Then the web server would talk to your database (because your web server can talk to MySQL). It would forward any info received back to your game over HTTP.

Check that article I linked, I think it would be a helpful way to start. NodeJS isn’t too hard to figure out if you know something like lua already.


I see, I am planning on using GAS Google apps script for the API, I am just worried if this Apps script is client sided because I am planning on using this as a service, many people (not only me) can connect to the database in a non-direct form
Imagine it like a fake password and user that goes on top of the real one, where you have a part of the server

If I store a variable with all the databases in it, will the one requiring the HTTP be able to get that variable and see all the content?

Because this API has a doGet function, so I don’t know if that is the only thing they can see or if they can see everything

GAS runs on Google’s servers, not the client.

You just return whatever you want from doGet, I guess. Just looking at the documentation. I’ve never used GAS, and there are probably better forums for GAS-specific questions :slight_smile:

So your game just makes a request to your web app, and the web app (running on google’s servers) responds with whatever you tell it to. In this case, I guess you’d make that MySQL data.

1 Like

I use PHP.

So I connect to my PHP website using the Roblox HTTP Service.
Using Lua I send the data across.
Then in my PHP file I use the get function to retrieve all the variables
Finally I use PHP to connect to the MySQL Database and create a new entry.


That’s a smart solution but I don’t know if OP knows PHP.