Go Back   The macosxhints Forums > Working with OS X > OS X Developer



Reply
 
Thread Tools Rate Thread Display Modes
Old 05-04-2006, 10:12 AM   #1
tripat
Prospect
 
Join Date: May 2006
Posts: 4
I have installed MAC OS X and installed pre-packed MySQL.

Then I have installed entropy PHP Version 4.3.11

But I am unable to make connections using PHP and MYSQL. Althouh, I can login to mysql using terminal window and can create and drop databases, but PHP doe snot connect.

I saw this article http://www.macosxhints.com/article.p...uery=php+mysql

and then I changed my php.ini so that
mysql.default_socket = /var/mysql/mysql.sock and it reflects in phpinfo also. I also made the owner of /var/mysql to mysql and also set up the permissions of /var/mysql to 755 but still I am just unable to make connection.

Any help or pointers will be appreciated.

Thanks,
Tripat
tripat is offline   Reply With Quote
Old 05-04-2006, 12:08 PM   #2
Newbish
Triple-A Player
 
Join Date: Nov 2002
Location: Massachusetts
Posts: 202
What version of MySQL are you running, and whose package did you install?

Are you using the installed PHP that came with your OS X, or are you using a version that you compiled from source code or installed from a package?

Third, are you trying to access the scripts through the web browser or are you trying to run them from the command line?

Knowing these things will help us determine what may be going wrong. Sadly, as convenient as the precompiled packages are, there are often variations that keep them from working as easily as one would like, depending on how they are going to be used.
__________________
There is no such thing as a stupid question. If you don't ask, you will never know.
Newbish is offline   Reply With Quote
Old 05-05-2006, 05:22 AM   #3
tripat
Prospect
 
Join Date: May 2006
Posts: 4
I am using MySQL Version 4.1.13a that is installed during OSX installation. It came pre-packed with the OSX.

I have installed entropy PHP packagaed, that I have downloaded and installed.

I am trying to run the PHP scripts from web browser.

Thanks for replying.
tripat is offline   Reply With Quote
Old 05-05-2006, 10:53 AM   #4
tripat
Prospect
 
Join Date: May 2006
Posts: 4
I have tried on command line and it works well from command line to give output in terminal screen.

But when I try using the webbrowser, it does not work and gives me connection not made error.

I using the following php code:

<?php
$linkid = mysql_connect("localhost","root","tripat") or die ("No connection");
echo $linkid;
exit;
?>

On command propmpt when I run : php tripat.php, it gives me "Resource id #4" but when I run on webbrowser, I get the error "No Connection".
tripat is offline   Reply With Quote
Old 05-05-2006, 10:58 AM   #5
schwartze
MVP
 
Join Date: Dec 2002
Location: NYC
Posts: 1,005
Try changing die ("No connection") to die (mysql_error()) and show us the error.

This will tell you what the error is rather than just "No Connection".
schwartze is offline   Reply With Quote
Old 05-05-2006, 11:03 AM   #6
tripat
Prospect
 
Join Date: May 2006
Posts: 4
I tried using the die(mysql_error()) and I get the following error:

Client does not support authentication protocol requested by server; consider upgrading MySQL client
tripat is offline   Reply With Quote
Old 05-05-2006, 01:07 PM   #7
Newbish
Triple-A Player
 
Join Date: Nov 2002
Location: Massachusetts
Posts: 202
Is the MySQL daemon running?

Quote:
I get the error "No Connection".

Most of the time, this error means mysqld isn't running. At the command line as "root", start mysql with this command:

mysqld_safe --user=mysql &

Upon a successful start, you should see this message:
Code:
Starting mysqld daemon with databases from....
Then try your script from the web browser. I'm pretty sure this will resolve the issue. (I've done this many times to myself...)

If you see the message below, then mysqld is already running and you have a different problem (which means we eliminated one possibility):
Code:
A mysqld process already exists
__________________
There is no such thing as a stupid question. If you don't ask, you will never know.
Newbish is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 04:24 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.