1

I was hoping to get some clarification on how to connect to mysql databases with a web app. There are lots of great answers on specific connection problems, but I was hoping to get some clarification on host type.

I have Ubuntu Server 16 with a LAMP stack. If I am hosting a website on the same server as the mysql server, and serving it to the web, what would my host be in the connection string for that page to connect to mysql?

Would it be localhost, or would I have to use some other parameter? When would someone use localhost in their mysql connection string, and when would you use a different host parameter?

1 Answer 1

1

Connection string depends of software you use, but yes, if you are on same machine with webserver and database, you refer to it as localhost or 127.0.0.1 or by hostname too, if you wish.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .