I get a "Connection Refused" error when I run the following batch file:
#!/usr/bin/php
<?php
mysql_connect('127.0.0.1', 'root', '*******');
?>
where * is a working password.
I've tried localhost too, but I get the same problem.
I know the password is good because I am able to connect just fine using:
> /Applications/MAMP/Library/bin/mysql -u root -p
I can also connect when I run the script from a browser (but I have to change 127.0.0.1 to localhost).
I'm using MAMP v1.8 on a Mac OS Lion.