Mysql connection on new install on a MAC

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
LostOZ1
Forum Newbie
Posts: 4
Joined: Wed Sep 29, 2010 2:26 pm

Mysql connection on new install on a MAC

Post by LostOZ1 »

Hi, I have installed Mysql and PHP 5 and when I go to test php <info> I can see the Mysql section is there. I can run php scripts so all is fine there. Terminal n to mysql and can create db's.

I have added a test db with a user and password, set the permissions so it can see the dbs and has all privileges. But when I run the mysql_connect e.g.

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>???</title>
<meta http-equiv="content-type"
	cotent="text/html; charset=iso-8859-1" />
</head>
<body>
<?php
$username = "pee_wee";
$password = "let_me_in";
$hostname = "localhost";	
$dbh = mysql_connect($hostname, $username, $password) 
	or die("Unable to connect to MySQL");
print "Connected to MySQL<br>";
// you're going to do lots more here soon
mysql_close($dbh);
?>
</body>
</html>
and it only comes back with unable to connect, so questions are?

What have I done wrong?

How do I see the log files for php and mysql on a Mac?
Post Reply