首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >访问DKAN时拒绝用户'root'@'localhost‘的访问

访问DKAN时拒绝用户'root'@'localhost‘的访问
EN

Stack Overflow用户
提问于 2020-12-01 06:51:16
回答 1查看 102关注 0票数 1

我安装了DKAN并短暂地工作了一下。然后我关闭了所有东西,并尝试再次打开它,我得到了以下错误消息:

代码语言:javascript
复制
The website encountered an unexpected error. Please try again later.
Drupal\Core\Database\DatabaseAccessDeniedException: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) in Drupal\Core\Database\Driver\mysql\Connection::open() (line 156 of /var/www/html/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php).
Drupal\Core\Database\Driver\mysql\Connection::open(Array) (Line: 376)
Drupal\Core\Database\Database::openConnection('default', 'default') (Line: 166)
Drupal\Core\Database\Database::getConnection('default')
call_user_func_array('Drupal\Core\Database\Database::getConnection', Array) (Line: 79)
Drupal\Component\DependencyInjection\PhpArrayContainer->createService(Array, 'database') (Line: 171)
Drupal\Component\DependencyInjection\Container->get('database', 1) (Line: 260)
Drupal\Component\DependencyInjection\PhpArrayContainer->resolveServicesAndParameters(Array) (Line: 62)
Drupal\Component\DependencyInjection\PhpArrayContainer->createService(Array, 'cache.container') (Line: 171)
Drupal\Component\DependencyInjection\Container->get('cache.container') (Line: 513)
Drupal\Core\DrupalKernel->getCachedContainerDefinition() (Line: 868)
Drupal\Core\DrupalKernel->initializeContainer() (Line: 466)
Drupal\Core\DrupalKernel->boot() (Line: 656)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

我相信这可能是因为我输入了值admin作为username,但当我在我的笔记本电脑(我使用Ubuntu18)上创建它时,数据库是从root创建的。然而,我仍然不知道这是否真的是问题所在,或者我该如何解决它

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-12-01 09:25:10

首先,为Drupal实例创建一个新的数据库用户,而不是使用root

在命令行上运行mysql -u root -p,并输入密码。然后:

代码语言:javascript
复制
 CREATE USER drupal@localhost IDENTIFIED BY 'secretpassword';
 GRANT ALL ON drupaldatabase.* TO drupal@localhost;

其次,在configuration file中配置Drupal应用程序以使用这个新用户。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65082299

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档