MySQL error installing Drupal

Ryan Schmidt ryandesign at macports.org
Tue Jan 12 06:55:30 PST 2010


Quoting Jasper Frumau:

> Trying to install Drupal which worked before. Wordpress runs without issues
> as we speak. Now, installing Drupal  I get this error using a connection
> test script:
>
> *Warning*: mysql_connect()
> [function.mysql-connect<http://localhost/drupal-6.15/function.mysql-connect>]:
> [2002] No such file or directory (trying to connect via
> unix:///tmp/mysql.sock) in *
> /Library/WebServer/Documents/drupal-6.15/connect-test.php* on line *2*

So either your MySQL server should have its socket file in  
/tmp/mysql.sock but doesn't (perhaps because it is not running), or  
your MySQL server has its socket file somewhere else and PHP needs to  
be told where it is.

The default socket for the MacPorts MySQL 5 server is  
/opt/local/var/run/mysql5/mysqld.sock. I believe the default socket  
for the mysql.com MySQL 5 server is /tmp/mysql.sock. Either server can  
have its socket location changed by editing the my.cnf file in the  
appropriate directory.

If your MySQL server is not running, start it. If it won't start,  
check the log. If there is no log, specify the log file location in  
the my.cnf, then start the server, then check the log.

If the MySQL server is running and its socket file is not in  
/tmp/mysql.sock, edit your php.ini to tell PHP where the socket is.  
Then restart your web server.






More information about the macports-users mailing list