Problems connecting to mysql using phpMyAdmin

Ryan Schmidt ryandesign at macports.org
Fri Nov 19 00:24:04 PST 2010


Ok, so in both cases, PHP is looking for the MySQL socket in /tmp/mysql.sock. That is not the default location for the MySQL socket; you should edit your php.ini and tell it where the MySQL socket actually is. When you installed the php5-mysql port it should have printed this message for you:


To use mysqlnd with a local MySQL server, edit /opt/local/etc/php5/php.ini and set
mysql.default_socket, mysqli.default_socket and pdo_mysql.default_socket
to /opt/local/var/run/mysql5/mysqld.sock





On Nov 19, 2010, at 02:17, Ali A Samii wrote:

> Well, from the browser, I got the following when I ran the phptest.php
> 
> 
> ( ! ) Warning: mysql_connect() [function.mysql-connect]: [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock) in /Volumes/External_Storage/www/phptest.php on line 2

> and from the command line, the result was:
> 
> Alis-iMac:www ali$ php phptest.php
> PHP Warning:  mysql_connect(): [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock) in /Volumes/External_Storage/www/phptest.php on line 2




More information about the macports-users mailing list