Bug #41144 Can't connect php to MySQL database to access simple database.
Submitted: 1 Dec 2008 7:20 Modified: 7 Dec 2016 18:29
Reporter: blake Southwood Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:5.1 OS:MacOS (Access Denied.)
Assigned to: CPU Architecture:Any
Tags: MySQL php Mac OS X access denied can't talk to database from php

[1 Dec 2008 7:20] blake Southwood
Description:
I have the free version of MySQL. I've been writing code for 20 years and this is definitely a bug.

I can't get PHP to talk to MySQL. I get message that Access denied. I have tried all the forums
on the web and every anwer involves different commands and ini files and sock errors messages
and yet the files that they refer to can't be accessed by vi nor bbedit.

I've wasted 2 days trying to get this working and I'm on the brink of going back to ColdFusion 8
since this is costing me valuable time. It seems bizarre to me that even with using XAMPP
a simple gui can't be made or a simple set of instructions to fix whatever permissions error
or password error. I tried downloading MySQL again and I still can't access MySQL from PHP.
So I can't talk to MySQL from php so I can complete building my site to compete with eBay.

And yet Mysql works

Your MySQL connection id is 8
Server version: 5.1.30 MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> 

How to repeat:
Get a Macbook Pro with Mac OS X 10.5.5 and put PHP and MySQL and Apache on it
and just try to talk to MySQL from PHP.

this works
$connection= mysql_connect($db_host, $db_username, $db_password);
if($connection){
echo " baby is talking to MySQL .";
//echo "<br>";
}
if(!$connection){
die ("Could <font color=red>not</font> connect to the database: <br>". mysql_error());
}
?>
but  this doesn't after that (when uncommented of course). I get an MySQL error Access Denied
that I don't have permission. And sometimes in the past today it said something about the sock.

/echo "<br>";
//$db_select= mysql_select_db($db_database);
//echo "talking to database bookstore";
//if (!$db_select){
//die ("coudl not select database". mysql_error());
/}
//echo "<br>";

Suggested fix:
Why doesn't this work. This is 2008 and not 1960. It should just work.
[1 Dec 2008 7:58] Sveta Smirnova
Thank you for the report.

Please provide content of variable $db_host and output of SHOW VARIABLES LIKE 'port' and SHOW VARIABLES LIKE 'hostname'
[2 Jan 2009 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[7 Dec 2016 18:29] Yngve Svendsen
Posted by developer:
 
This relates to EOL (no longer supported) versions of MySQL Server. Furthermore, both Mac OS X and MySQL on OS X have gone a long way since this was reported. Thus closing.