【问题标题】:Access denied on Drupal site after changing cPanel password更改 cPanel 密码后,Drupal 站点上的访问被拒绝
【发布时间】:2018-08-22 02:18:41
【问题描述】:

我的同事更改了 Drupal 站点的 cPanel 密码。前端现在显示以下错误。

错误
网站遇到意外错误。请稍后再试。

错误消息 PDOException: SQLSTATE[HY000] [1045] 在 lock_may_be_available()(/home/xx/public_html/includes/lock.txt 的第 167 行)中用户 'xx'@'localhost' 的访问被拒绝(使用密码:YES)公司)。

如何解决这个错误?

【问题讨论】:

    标签: drupal drupal-database


    【解决方案1】:

    如果仅更改了密码,并且您收到该错误,则意味着访问 Drupal 知道的数据库的密码也需要更改。默认情况下,它存储在 sites/default/settings.php 文件中。在该文件中查找类似于以下的代码。

     $databases['default']['default'] = array(
       'database' => 'databasename',
       'username' => 'sqlusername',
       'password' => 'sqlpassword',
       'host' => 'localhost',
       'port' => '3306',
       'driver' => 'mysql',
       'prefix' => '',
       'collation' => 'utf8mb4_general_ci',
     );
    

    最重要的部分是前三行,特别是 password => 之后的部分,应该是实际密码。 (databasenamesqlusernamesqlpassword 是实际值的占位符。)

    由于 Drupal 可以使用不同的 settings.php 文件,请检查站点目录中没有其他具有该文件名的文件。例如,如果 Drupal 安装在 https://www.drupal.org:8080/mysite/test/ 上,则在以下目录中搜索 settings.php 文件。

    • sites/8080.www.drupal.org.mysite.test
    • sites/www.drupal.org.mysite.test
    • sites/drupal.org.mysite.test
    • sites/org.mysite.test
    • sites/8080.www.drupal.org.mysite
    • sites/www.drupal.org.mysite
    • sites/drupal.org.mysite
    • sites/org.mysite
    • sites/8080.www.drupal.org
    • sites/www.drupal.org
    • sites/drupal.org
    • 网站/组织
    • 网站/默认

    然后,sites/sites.php 文件的内容可以更改使用哪个 settings.php 文件。例如,对于以下 sites.php 文件,sites/example.com/settings.php 文件用于域 example.org、example.it 和 example.com。

    $sites['example.org'] = 'example.com';
    $sites['example.it'] = 'example.com';
    $sites['example.com'] = 'example.com';
    

    【讨论】:

      猜你喜欢
      • 2015-05-15
      • 2014-09-19
      • 2023-04-04
      • 1970-01-01
      • 2016-12-15
      • 2016-09-25
      • 2018-07-03
      • 2019-02-07
      • 2020-05-05
      相关资源
      最近更新 更多