I have got MySQL Workbench 5.244 installed. I have a server instance created (MySQL55). Everything works perfect inside the workbench.
The problem is when I try to connect to the server on my PHP (version 4.2.1) file.

(Pleasew find header.php and default.php below)

I get the message below:

Warning: Unknown MySQL Server Host 'MySQL55' (0) in c:\webroot\default.php on line 3

Warning: MySQL Connection Failed: Unknown MySQL Server Host 'MySQL55' (0) in c:\webroot\default.php on line 3
Could not connect: Unknown MySQL Server Host 'MySQL55' (0)

I am new to php but this code was working when I had it lodged on an external web server.

Can somenone help?

Thank you.

Mario van Grichen

    <?php 
    $server_name="MySQL55";
    $server_user="root";
    $server_password="************";
    $db_name="a4874781_Genix";
    ?>




    include 'header.php';
    $con = mysql_connect($server_name,$server_user,$server_password);
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }

    mysql_select_db($db_name, $con);

    $event = mysql_query("SELECT * FROM event WHERE usageTP='M' ORDER BY eventDS");

    echo "<table border='0'>
    <tr>
    <th>Event Type</th>
    <th>Description</th>
    <th>Usage</th>
    </tr>";

    while($row = mysql_fetch_array($event))
      {
      echo "<tr>";
      echo "<td>" . $row['eventTP'] . "</td>";
      echo "<td>" . $row['eventDS'] . "</td>";
      echo "<td>" . $row['usageTP'] . "</td>";
      echo "</tr>";
      }
    echo "</table>";

    mysql_close($con);
    ?><?php
    include 'header.php';
    $con = mysql_connect($server_name,$server_user,$server_password);
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }

    mysql_select_db($db_name, $con);

    $event = mysql_query("SELECT * FROM event WHERE usageTP='M' ORDER BY eventDS");

    echo "<table border='0'>
    <tr>
    <th>Event Type</th>
    <th>Description</th>
    <th>Usage</th>
    </tr>";

    while($row = mysql_fetch_array($event))
      {
      echo "<tr>";
      echo "<td>" . $row['eventTP'] . "</td>";
      echo "<td>" . $row['eventDS'] . "</td>";
      echo "<td>" . $row['usageTP'] . "</td>";
      echo "</tr>";
      }
    echo "</table>";

    mysql_close($con);
    ?>    <?php 
    $server_name="MySQL55";
    $server_user="root";
    $server_password="************";
    $db_name="a4874781_Genix";
    ?>
Member Avatar for LastMitch

@mgrichen

Warning: Unknown MySQL Server Host 'MySQL55' (0) in c:\webroot\default.php on line 3

Which line is line 3?

Hi
3rd line is
$con = mysql_connect($server_name,$server_user,$server_password);

can you try $server_name="localhost", if it does not work for you, read more about it here.

I changed to server name to "localhost" with no success.
I can check on my task bar that mysqld is running.
I am running these applications on XP SP3.
The web server is Apache 1.3.24.
I should be able to access the worknench instance.
Could it be a priveleges problem?

Yes, I will upgrade and try the plugin.
Let's see what it bring :-)
Thanks a a lot

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.