Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.When installing Drupal 6, it looks for the MySQL socket at a location other than what I specified in my php.ini config file. This is the error message I get:
Failed to connect to your MySQL database server. MySQL reports the following message: Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (2).
...however, my socket is located in a different folder. I have changed the php.ini file to reflect the new location of the mysql.sock file for both the mysql and mysqli php modules (it probably does not matter for mysqli, but I'm not completely familiar with the install process/parameters). The question I ask is, why does Drupal 6 need to worry about where the socket file is?
I am running PHP 5 on Mac OS X. Drupal 5 installs perfectly, by the way.
Comments
Comment #1
chx commentedComment #2
vesapalmu commentedI have the same issue with rc1. My environment is PHP 5.2.4 running on OS X. No problems with Drupal 5 in the same environment.
Detailed info from mysql section of phpinfo():
mysql
MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 5.0.45
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /opt/local/var/run/mysql5/mysqld.sock
MYSQL_INCLUDE -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/mysql5/include/mysql
MYSQL_LIBS -L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_www_php5/work/mysql5/lib/mysql -lmysqlclient
Directive Local Value Master Value
mysql.allow_persistent On On
mysql.connect_timeout 60 60
mysql.default_host localhost localhost
mysql.default_password no value no value
mysql.default_port no value no value
mysql.default_socket /tmp/mysql.sock /tmp/mysql.sock
mysql.default_user no value no value
mysql.max_links Unlimited Unlimited
mysql.max_persistent Unlimited Unlimited
mysql.trace_mode Off Off
Drupal is trying to use value of MYSQL_SOCKET instead of correct value at mysql.default_socket.
Comment #3
chx commentedThis still has nothing to do with Drupal. This is a PHP issue. Set up your server properly. We do not set sockets specifically. On connecting to localhost the mysql library linked to php will try to connect to a socket and either succeed or not.
Comment #4
vesapalmu commentedThis is actually a configuration issue when using PHP from MacPorts. MarPorts version of PHP has both mysql and mysqli included. Older versions of Drupal use mysql and 6.0 defaults to mysqli. I had mysql.default_socket set in my php.ini, but needed to set mysqli.default_socket instead.
Just a bit confusing configuration issue when both mysql and mysqli extensions are installed with PHP.