安装phabricator时无法连接到mysql

时间:2015-01-20 18:24:42

标签: php mysql linux apache phabricator

我正在linux中安装phabricator并遵循https://secure.phabricator.com/book/phabricator/article/installation_guide/http://www.tecmint.com/install-phabricator-in-linux/

的安装指南

当我尝试从网址访问phabricator时,我得到的响应就像

    Unable to connect to MySQL!

     Attempt to connect to root@127.0.0.1 failed with error #2003: Can't connect to MySQL server on '127.0.0.1' (13).

     Make sure Phabricator and MySQL are correctly configured.

To update these 4 value(s), run these command(s) from the command line:
phabricator/ $ ./bin/config set mysql.host value
phabricator/ $ ./bin/config set mysql.port value
phabricator/ $ ./bin/config set mysql.user value
phabricator/ $ ./bin/config set mysql.pass value

当我配置我的mysql并且如果我运行phabricator/ $ ./bin/storage upgrade我收到错误

   [2015-01-20 18:12:04] EXCEPTION: (AphrontAccessDeniedQueryException) #1044: Access denied for user ''@'localhost' to database 'phabricator_audit' at [<phutil>/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:301]
  #0 AphrontBaseMySQLDatabaseConnection::throwQueryCodeException(integer, string) called at [<phutil>/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:275]
  #1 AphrontBaseMySQLDatabaseConnection::throwQueryException(mysqli) called at [<phutil>/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:181]
  #2 AphrontBaseMySQLDatabaseConnection::executeRawQuery(string) called at [<phutil>/src/xsprintf/queryfx.php:6]
  #3 queryfx(AphrontMySQLiDatabaseConnection, string, string) called at [<phabricator>/src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php:219]
  #4 PhabricatorStorageManagementAPI::applyPatchSQL(string) called at [<phabricator>/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementUpgradeWorkflow.php:109]
  #5 PhabricatorStorageManagementUpgradeWorkflow::execute(PhutilArgumentParser) called at [<phutil>/src/parser/argument/PhutilArgumentParser.php:396]
  #6 PhutilArgumentParser::parseWorkflowsFull(array) called at [<phutil>/src/parser/argument/PhutilArgumentParser.php:292]
  #7 PhutilArgumentParser::parseWorkflows(array) called at [<phabricator>/scripts/sql/manage_storage.php:171]

如果我运行./bin/storage upgrade --user root --password root我收到错误

Raw MySQL Error: Attempt to connect to root@localhost failed with error
#1045: Access denied for user 'root'@'localhost' (using password: YES).

这是我的apache设置,

<VirtualHost *:80>
        ServerAdmin root@xxx.yyy.com
        ServerName xxx.yyy.com
        DocumentRoot /var/www/html/myprojectapp/phabricator/webroot
        RewriteEngine on
        RewriteRule ^/rsrc/(.*)     -                       [L,QSA]
        RewriteRule ^/favicon.ico   -                       [L,QSA]
        RewriteRule ^(.*)$          /index.php?__path__=$1  [B,L,QSA]
<Directory "/var/www/html/myprojectapp/phabricator/webroot">
        Order allow,deny
        Allow from all
</Directory>
</VirtualHost>

我已按照安装指南中提供的所有说明进行操作。任何人都可以帮我指出我的错误吗?

5 个答案:

答案 0 :(得分:3)

GRANT ALL PRIVILEGES ON * . * TO 'phabricatoruser'@'localhost';

为我做了诀窍。你可以限制当然的特权。

答案 1 :(得分:2)

我遇到同样的问题,修复非常简单:

./bin/config set mysql.host 'localhost'

./bin/config set mysql.user 'root'

./bin/config set mysql.pass 'pass'

不要忘记我用2天时间修复此问题的“引号”!!

答案 2 :(得分:1)

这是一个selinux问题。 禁用它解决了它。 1编辑此文件vim / etc / selinux / config 2更改SELINUX =强制执行---&gt; SELINUX =禁用 3重启

答案 3 :(得分:0)

您的数据库用户很可能没有创建权限。

使用mysql登录:mysql -u user -p 并尝试:create database temp;

如果未创建数据库,则需要向用户授予创建权限。

检查this以获取mysql Grant语法。

答案 4 :(得分:0)

好吧,我也遇到了同样的问题,几个小时后就解决了:(

看来我的密码末尾有美元符号 $

我将mysql密码更改为简单的字母和数字,没有特殊字符。

奇怪,但这为我解决了问题!

我没有进行任何进一步的调查,但是mysql密码中的特殊字符似乎是一个问题。