For connecting to a Database you only need to know is in which port its running. a default MySQL installation would configure it to run on 3306. First find out port number for MySQL in webserver(device) and that will solve your case.
If you had installed device server first and it install MySQL, it would be running on 3306(if u didn't change it) then you install wamp, which also install MySQL again on 3306 port. This will be a problem, two mysql instance can't run on same port. so you either remove mysql from wamp server or change its port number.
Connecting to a mysql from php doesn't depend on server as long as you provide ip/domain and port. so your proper php script would be:
<?php
// we connect to localhost at port 3307
$link = mysql_connect('127.0.0.1:3307', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
For windows, If you want to know the port number of your local host on which Mysql is running you can use this query on MySQL Command line client --
mysql> SHOW VARIABLES WHERE Variable_name = 'port';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port | 3306 |
+---------------+-------+
1 row in set (0.00 sec)