user5214864
user5214864

Reputation:

connect to mysql database using php on different port

my connection string is:

    $connection = mysql_connect("localhost", "root", "") or die("Could Not Connect to DB: ".mysql_error());

but on my computer i have installed IIS server first so localhost:80 is reserved by it so I changed my port to 8080 changing httpd.conf file in apache folder.

Now what should I change in connection string to connect to my database. I am using XAMPP .

should I tried writing these: 1:

  $connection = mysql_connect("localhost:8080", "root", "") or  die("Could Not Connect to DB: ".mysql_error());

2:

$connection = mysql_connect("localhost,8080", "root", "") or    die("Could Not Connect to DB: ".mysql_error());

But Not working Help please. Thank You

Upvotes: 2

Views: 8451

Answers (1)

Mohsen Alizadeh
Mohsen Alizadeh

Reputation: 1603

Default port number which Mysql server uses is 3306 Web servers default port is 80

Web server and Mysql server are independent.

Do not change your api to connect to your mysql

Upvotes: 2

Related Questions