views:

296

answers:

3

I'm on a mac server. From my home directory, I can get to mysql on the command line. But apps I install (I've tried phpMyAdmin and then Wordpress) can't connect to mysql@localhost.

Suggestions on troubleshooting the problem?

Also, how can I tell what port mysql is running on?

+2  A: 

Try specifying 127.0.0.1:3306 as the host and see if that works...

Edit from comments:

Use netstat -a to check which port MySQL is listening on.

John Rasch
Does netstat -a indicate that it's listening on 3306?
John Rasch
Yep, wrong port. Thanks.
lynn
That will do it, lol.
M4dRefluX
+1  A: 

Check to make sure you have the mysql extension installed.

More information: http://us2.php.net/mysql

M4dRefluX
+1  A: 

Make sure you have explicitly listed localhost when you granted permissions to the user. For example, if you have a database named blog which is accessed by a user named wordpress, you need to create the user with this:

grant all on blog.* to 'wordpress'@'localhost' identified by 'blahblah';

I believe that the mysql command-line utility uses Unix file sockets to connect, which bypasses any hostname or DNS restrictions.

Barry Brown