What is in place of "localhost" when connecting to a live database?

Hi

I’m Lila (pen name :grin:), brand new to backend programming. I’ve followed through with some of Daniel Neilsen’s tutorials on YT, an excellent teacher by the way, and everything is going smoothly. I’ve even set up a few websites using GridHost as my web hosting server.
One thing I’m struggling to figure is connecting to a live database. When I connect to my localhost (XAMPP) database, I would make up the dbh.inc.php file as follows:

$dbServer = “localhost”;
$dbUserame = “root”;
$dbPass = “”;
$dbName = “myfirstdatabase”;

Now, what do I put in the double quotes if I were to connect to a live database in cPanel?

What exactly do the server, username and password refer to?

I know this should be super obvious but I have really no clue what to search for, and the tutorials I’ve watched so far seem like they skip this step entirely because it’s so obvious. Help would be deeply appreciated.

$dbServer = “localhost”;
$dbUserame = “root”;
$dbPass = “”;
$dbName = “myfirstdatabase”;

for dBServer, it will be the IP address (or hostname) of where your database is hosted by your web host.
for dBUsername, the specific Username (UserID) assigned by your web host to your database account.
dbPassword, the password the web host assigned to your username.

What exactly do the server, username and password refer to?

The account credentials to your (I assume), mySQL database.

It seems the problem was with my hosting server… I tried it on a different hosting server and it worked. Thanks for answering :slight_smile: