Skip to content
← Back to Community
How do I use a database with the new php server?
Profile icon
bitbyte2013

I am wondering if there is any way to create and access a database from the php server.

Voters
Profile icon
MehulKChaudhari
Profile icon
EvanNadeau
Profile icon
LeoXu2
Profile icon
gwendalsaloum
Profile icon
heyitsmarcus
Profile icon
RaphaelSpoerri
Profile icon
bitbyte2013
Comments
hotnewtop
Profile icon
LuukDev

You can use the normal PHP codes and set your personal info like passwords in a .env file. With the getenv you can get the info without that anyone can see the info.

Profile icon
heyitsmarcus

You can't create a MySQL database on a repl.it instance, as of right now. You can connect to an external database, though, and modify it from a repl.it instance.

Profile icon
bitbyte2013
Profile icon
heyitsmarcus

@bitbyte2013 If you're not stuck on needing SQL commands, there are some free JSON services you can use such as http://jsonstore.io. It provides a free endpoint for storing JSON data. You can use it to get down what you need for a NoSQL database.

Profile icon
oshah

@heyitsmarcus How would you connect an external database?

Profile icon
heyitsmarcus

@938273849564729 It more or less depends on where your external database is hosted. But, all you should need to do is ensure that you can connect remotely to the database by connecting to the IP of the server hosting it and providing credentials the way you would any other database.

Profile icon
oshah

@heyitsmarcus So if I install a local SQL server, repl.it will be able to connect to it?

Profile icon
heyitsmarcus

@938273849564729 if your local machine will allow a remote connection to the database then yes. You'll have to look up how to enable remote connections to your particular instance of your SQL server.