我浏览了相关的帖子及其建议的解决方案(此处和此处),但它们似乎对我的情况没有帮助。
我在 Snow Leopard 上运行 MacPorts 2.1.2,并且安装了以下软件包:
php5-mysql @5.3.15_0+mysql5 (active)
php5 @5.3.15_0+apache2 (active)
mysql5 @5.1.63_0 (active)
mysql_select @0.1.2_0 (active)
apache2 @2.2.22_2+preforkmpm (active)
我可以将我的网络浏览器指向 localhost,它将连接到默认站点;一个测试 index.php
<?php phpinfo() ?>
页面也可以正常工作,因此我假设此时 PHP 可以正常工作。问题是连接到已安装的 MySQL 服务器。phpmyadmin 和 Joomla 似乎都无法连接,并且尝试 .php 测试脚本也会导致问题。对于如何从这里开始,我有点不知所措。
MySQL 服务器显然正在运行:
~ > ps ax | grep mysql
10884 ?? S 0:00.03 /bin/sh /opt/local/lib/mysql5/bin/mysqld_safe
10930 ?? S 0:07.66 /opt/local/libexec/mysqld --basedir=/opt/local --datadir=/opt/local/var/db/mysql5 --user=_mysql --log-error=/opt/local/var/db/mysql5/tigger.local.err --pid-file=/opt/local/var/db/mysql5/tigger.local.pid
我可以使用 mysql 客户端:
~ > mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 5.1.63 Source distribution
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
+--------------------+
2 rows in set (0.04 sec)
mysql> show grants for 'root'@'localhost';
+---------------------------------------------------------------------+
| Grants for root@localhost |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
+---------------------------------------------------------------------+
1 row in set (0.00 sec)
有插座
~ > ll /opt/local/var/run/mysql5/mysqld.sock
srwxrwxrwx 1 _mysql admin 0 Jul 31 16:55 /opt/local/var/run/mysql5/mysqld.sock
php.ini 包含 MySQL 模块和配置
~ > /opt/local/bin/php -i | grep mysql | grep socket
mysql.default_socket => /opt/local/var/run/mysql5/mysqld.sock => /opt/local/var/run/mysql5/mysqld.sock
mysqli.default_socket => no value => no value
pdo_mysql.default_socket => /opt/local/var/run/mysql5/mysqld.sock => /opt/local/var/run/mysql5/mysqld.sock
在我看来,这一切都应该是这样的。但是,当我尝试使用“root”登录 phpmyadmin 时,连接失败,在 Joomla 设置期间也会发生同样的情况。
任何帮助,提示,建议表示赞赏:-)