Solved

PHP/MySQL 5.1 Server Connection problem

Posted on 2013-10-22
11
404 Views
Last Modified: 2013-10-22
Hello.  I'm running WAMP, MySQL & Apache Server services are started.  I created a folder on the desktop to place the ".AMP" installation information.  I created a MySQL user with the appropriate permissions.  However, when I run the mysql_connect("localhost", "user", "password") or die( "foo" ), I get the server connection error.  

What am I missing?

Thanks,

Cameron.
0
Comment
Question by:VDOGamer
  • 6
  • 5
11 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39592072
Details needed because it is probably a detail that is causing the issue.  What OS are you running?  Do you have IIS running?  Is it a 64-bit machine?  64-bit machines sometimes define 'localhost' as '::1' which is the IPV6 version.  MySQL wants to see '127.0.0.1' which is the IPV4 version.
0
 

Author Comment

by:VDOGamer
ID: 39592127
Sorry about that.  I'm running win7 64 and I do have IIS 6 running.  I stopped IIS 6, but the problem is the same.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39592400
You may have to un-install IIS to get WAMP's Apache to work on port 80.  Or put Apache on another port like 8080.  Try using mysql_connect("127.0.0.1", "user", "password") .  You can look in Task Manager to see if 'mysqld', the MySQL daemon, is running.  If not, go to the WAMP control Icon in the task bar and start it.
0
 

Author Comment

by:VDOGamer
ID: 39592514
Okay.  IIS was uninstalled and I used the mysql_connect("127.0.0.1:8080", "user", "password")
mysqld is running.
...now something is running.......forever
0
 

Author Comment

by:VDOGamer
ID: 39592518
I didn't use the WAMP installation package.  I installed Apache, MySQL, PHP, then phpMyAdmin.
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 39592603
I would have recommended the WAMP or XAMPP packages because they do all the set up for you.  Installing them separately means that you have to do the set up that is required.  If you decide to go back and use WAMP or XAMPP, you will need to completely uninstall Apache, MySQL, and PHP so there won't be any conflicts.
0
 

Author Comment

by:VDOGamer
ID: 39592634
Okay.  Do I have to enable Apache, MySQL, and PHP access through the firewall?
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39592675
You will if you want to access them remotely or by the machine's IP address.  Is phpMyAdmin currently working on your machine?
0
 

Author Comment

by:VDOGamer
ID: 39592686
Yes it is.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39592752
Then PHP and Apache are working.  I don't know why your connection 'runs forever'.  Except that... MySQL is on port 3306.

mysql_connect("127.0.0.1:3306", "user", "password")
0
 

Author Comment

by:VDOGamer
ID: 39592993
Switching to the WAMP installation package now.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Creating and Managing Databases with phpMyAdmin in cPanel.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

929 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

11 Experts available now in Live!

Get 1:1 Help Now