My apps can't connect to mysql, can you suggest things to test?
Question
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?
Solution
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.
OTHER TIPS
Check to make sure you have the mysql extension installed.
More information: http://us2.php.net/mysql
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.