Mac OS 10.6.5 中 Postgresql 的 Drupal 7 配置错误
我正在尝试使用 Postgres 配置 Drupal 7。在数据库设置步骤中,我收到以下错误。
警告:PDO::_construct(): [2002] DatabaseConnection-> 中没有这样的文件或目录(尝试通过 unix:///var/mysql/mysql.sock 连接)_construct()(/Users/shamod/Sites/drupal/7/includes/database/database.inc 第 300 行)。 为了让 Drupal 正常工作并继续安装过程,您必须解决下面报告的所有问题。有关配置数据库服务器的更多帮助,请参阅安装手册。如果您不确定这意味着什么,您可能应该联系您的托管提供商。 无法连接到您的数据库服务器。服务器报告以下消息: SQLSTATE[HY000] [2002] 没有这样的文件或目录。 数据库服务器是否正在运行? 数据库是否存在,您是否输入了正确的数据库名称? 您输入了正确的用户名和密码吗? 您输入了正确的数据库主机名吗?
注意:我正在尝试连接到 Postgresql,但由于 var/mysql/mysql.sock 错误而失败。我已经在 settings.php 中为 Postgresql 设置了数据库连接字符串。它仍然不起作用。
有什么想法吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
显然您正在尝试连接到 MySQL 数据库实例,因此您应该检查您的数据库驱动程序和连接配置。
Evidently you are trying to connect to a MySQL database instance, so you should review your database driver and connection configuration.
我自己在尝试使用网络安装程序时就遇到了这个错误 - 可能会归结为类似的问题。
在安装页面上,我没有提供使用 Postgres 驱动程序的选项,因此我认为我需要使用“Mysql(或其他)”选项。然而,看起来 Drupal 安装脚本会检查哪些数据库驱动程序被编译成 PHP,并且只提供可用的驱动程序 - 我的系统默认情况下没有安装 php-pgsql。
所以我需要先将 postgresql 驱动程序安装到 PHP,重新加载 apache,然后再次尝试安装。
在 CentOS-5 上:
然后重新加载安装页面,一切正常。
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:
Then reload the install page and all worked fine.