1. Home
  2. Hosting and Web
  3. Databases
  4. Connecting application to a database via localhost (mysql_connect)

Connecting application to a database via localhost (mysql_connect)

If you need to connect your application to a database via localhost, you need to set in Webadmin what type of database should localhost points at.

To set the localhost pointing:

1. Log in to the WebAdmin

2. In the Services locate your domain and select it

3. In the left menu select WEB and then PHP settings.

4. Last line is a “type of DB for mysql_connect(‘localhost’)”. Here select what type of database should localhost point to.

If you are connecting a database via mysql_connect or mysqli_connect with the value “localhost”, you will be always pointed to the database server type set in WebAdmin. Setting is used for all PHP scripts of all applications under the domain. To connect to different types of databases under one domain do not use “localhost” but connect via socket.

Updated on October 3, 2024

Was this article helpful?

Related Articles