I am having trouble connecting to my database

I was having a problem with my extension=php_mysqli.dll cranial-bore helped me with that now when I try to connect I am getting another fatal error statements. Here are the error messages I am getting.

Warning: mysqli_connect() [function.mysqli-connect]: [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) in C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\connect\\index.php on line 2

Warning: mysqli_connect() [function.mysqli-connect]: (HY000/2002): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\connect\\index.php on line 2

Fatal error: Maximum execution time of 30 seconds exceeded in C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\connect\\index.php on line 2

and here is the index.php page I am using.

  <?php
      $link = mysqli_connect('localhost', 'root', 'myPassword');
      if (!$link)
      {
        $output = 'Unable to connect to the database server.';
        include 'output.html.php';
        exit();
      }
      if (!mysqli_set_charset($link, 'utf8'))
      {
          $output = 'Unable to set database connection encoding.';
          include 'output.html.php';
          exit();
     }
      if (!mysqli_select_db($link, 'ijdb'))
      {
          $output = 'Unable to locate the joke database.';
          include 'output.html.php';
          exit();
      }
      
      $output = 'Database connection established.';
      include 'output.html.php';
      ?>

and here is my output page.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
              <html xmlns="http://www.w3.org/1999/xhtml"> 
              <head>
                <title>PHP Output</title>
               <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
               
               </head>

     
              <body>
                <p>
                  <?php echo $output; ?>
                </p>
            
              </body>
              </html>

All help appreciated thank you Codin

Try object oriented way to use mysqli library functions:
http://www.php.net/manual/en/mysqli.connect.php