Unable to access MySql data table on local host

Posted on 2012-09-10
Last Modified: 2012-09-17
I am attempting to port an established web site with mysql backend to an intranet site.  To date I have established the database and web site, with tables and data, on a stand-alone Windows 7/Wamp setup.


      Internet:      MySQL 5.0, PHP 5, Apache on Linux Server

      Intranet:      MySQL 5.0.7, PHP 5.3.5, Apache 2.2.17, on Windows 7 (WampServer)

The intranet web site functions correctly.  I can access the database from phpmyadmin however, when I attempt to use the intranet form (php/html) to access the database I am getting the following errors:

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'dbo386913170'@'localhost' (using password: YES) in C:\wamp\www\cfus_c712911\tik_cfus11.php on line 4

Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in C:\wamp\www\cfus_c712911\tik_cfus11.php on line 5

The offending code is:

      1.  <?php
      2.  include("");
      4.  $con = mysql_connect($host, $user,$passwd);
      5.  mysql_select_db($database, $con) or die ("Couldn't select database.");
      9. $result = mysql_query("SELECT * FROM c712911 ORDER BY Patrol ASC LIMIT
      11. ?>

The "" code is:

      1. <?php
      2. $host = "localhost";
      3. $user = "dbo386913170";
      4. $passwd = "xxxxxxx";
      5. $database = "db386913170";
      6. ?>

I am no expert nor am I a regular user of WampServer.  I know that I am missing the obvious, but I could use some assistance in resolving this issue.
Question by:dibrandt
    LVL 21

    Expert Comment

    by:Kim Walker
    What is the URL of your intranet form? Are you using an intranet IP address to access the form on the WAMP server or an intranet computer name?

    Author Comment

    Intranet form is accessed via browser pojnted at  This opens the web site on the "localhost", and you drill down to the desired form.
    LVL 21

    Expert Comment

    by:Kim Walker
    "localhost" is your local computer, not the server. If the website is opened on the "localhost" is it not opened on unless is the IP of the local computer.

    Author Comment

    As I said, I am a limited user of WampServer, and the semantics can be confusing.

    WampServer is installed on a PC,, and WampServer documentation refers to this as “localhost.”

    My understanding is that a request for a table must be pointed to the location of that table.  As the request is originating from the web site located on the PC at, my “assumption” was that it was the same as “localhost” (the database and the form requesting the table reside on the same PC.

    Could you provide the correct terminology to use when describing the WampServer so that I will have it right in future discussions?
    LVL 21

    Expert Comment

    by:Kim Walker
    That sounds correct. You are actually opening the website on The website would then be making a mysql request on localhost. If your browser address bar begins with "" you should be OK. That should work. I'll have to let someone more familiar with wamp on Windows continue from here.

    Accepted Solution

    After many hours of searching through forums I found a workaround for this problem.

    Assign access to all databases (there are nine involved) via “root” with no password.  This required changing a good number of html/php pages, but the localhost can now use the database.

    Author Closing Comment

    The solution was arrived at before an of the experts attempted to address the issue.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    6 Experts available now in Live!

    Get 1:1 Help Now