?
Solved

Unable to access MySql data table on local host

Posted on 2012-09-10
7
Medium Priority
?
666 Views
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.

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.
0
Comment
Question by:dibrandt
  • 4
  • 3
7 Comments
 
LVL 22

Expert Comment

by:Kim Walker
ID: 38382698
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
 

Author Comment

by:dibrandt
ID: 38382767
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
 
LVL 22

Expert Comment

by:Kim Walker
ID: 38382823
"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
Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

 

Author Comment

by:dibrandt
ID: 38382910
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
 
LVL 22

Expert Comment

by:Kim Walker
ID: 38382953
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
 

Accepted Solution

by:
dibrandt earned 0 total points
ID: 38393028
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
 

Author Closing Comment

by:dibrandt
ID: 38404790
The solution was arrived at before an of the experts attempted to address the issue.
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Determining the an SCCM package name from the Package ID
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month13 days, 9 hours left to enroll

749 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