Drupal 7 configuration error with Postgresql in Mac OS 10.6.5

蓝咒 提交于 2019-12-13 05:45:27

问题


I am trying to configure Drupal 7 with Postgres. At the database setup step, I get the following error.

Warning: PDO::_construct(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in DatabaseConnection->_construct() (line 300 of /Users/shamod/Sites/drupal/7/includes/database/database.inc). In order for Drupal to work, and to continue with the installation process, you must resolve all issues reported below. For more help with configuring your database server, see the installation handbook. If you are unsure what any of this means you should probably contact your hosting provider. Failed to connect to your database server. The server reports the following message: SQLSTATE[HY000] [2002] No such file or directory. Is the database server running? Does the database exist, and have you entered the correct database name? Have you entered the correct username and password? Have you entered the correct database hostname?

NOTE: I am trying to connect to Postgresql but it fails on var/mysql/mysql.sock error. I have setup the database connection string in settings.php for Postgresql. It still does not work.

Any idea?


回答1:


Evidently you are trying to connect to a MySQL database instance, so you should review your database driver and connection configuration.




回答2:


Just came up against this error myself when trying to use the web installer - might come down to a similar issue.

On the install page I wasn't given an option to use Postgres driver so I assumed I needed to use the "Mysql (or other)" option. However, looks like the Drupal install script checks which database drivers are compiled into PHP and only offers you what is available - my system didn't have php-pgsql installed by default.

So I needed to install the postgresql drivers to PHP first, reload apache then try the install again.

On CentOS-5:

sudo yum install php-pgsql
sudo service httpd restart

Then reload the install page and all worked fine.



来源:https://stackoverflow.com/questions/4664903/drupal-7-configuration-error-with-postgresql-in-mac-os-10-6-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!