Unable to access MySql data table on local host

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.

Specifics:

      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("eCFUVars.inc");
      3.
      4.  $con = mysql_connect($host, $user,$passwd);
      5.  mysql_select_db($database, $con) or die ("Couldn't select database.");
      6.
      7.
      8.
      9. $result = mysql_query("SELECT * FROM c712911 ORDER BY Patrol ASC LIMIT
                      1,85");
      10.
      11. ?>

The "include.inc" 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.
dibrandtAsked:
Who is Participating?
 
dibrandtConnect With a Mentor Author Commented:
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.
0
 
Kim WalkerWeb Programmer/TechnicianCommented:
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?
0
 
dibrandtAuthor Commented:
Intranet form is accessed via browser pojnted at 172.20.30.55.  This opens the web site on the "localhost", and you drill down to the desired form.
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
Kim WalkerWeb Programmer/TechnicianCommented:
"localhost" is your local computer, not the server. If the website is opened on the "localhost" is it not opened on 172.20.30.55 unless 172.20.30.55 is the IP of the local computer.
0
 
dibrandtAuthor Commented:
As I said, I am a limited user of WampServer, and the semantics can be confusing.

WampServer is installed on a PC, 172.20.30.55, 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 172.20.30.55, 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?
0
 
Kim WalkerWeb Programmer/TechnicianCommented:
That sounds correct. You are actually opening the website on 172.20.30.55. The website would then be making a mysql request on localhost. If your browser address bar begins with "http://172.20.30.55/" you should be OK. That should work. I'll have to let someone more familiar with wamp on Windows continue from here.
0
 
dibrandtAuthor Commented:
The solution was arrived at before an of the experts attempted to address the issue.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.