我尝试reset the admin password for a Drupal account,但似乎pass
表中似乎没有users
字段。
UPDATE users
SET pass ='$S$CTo9G7Lx28rzCfpn4WB2hUlknDKv6QTqHaf82WLbhPT2K5TzKzML'
WHERE uid = 1;
相反,表格pass
中有users_field_data
字段。这对Drupal意味着什么?
我无法在users_field_data
表格上找到任何文档。
我在Drupal VERSION =' 8.2.7';
mysql> show create table users;
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| users | CREATE TABLE `users` (
`uid` int(10) unsigned NOT NULL,
`uuid` varchar(128) CHARACTER SET ascii NOT NULL,
`langcode` varchar(12) CHARACTER SET ascii NOT NULL,
PRIMARY KEY (`uid`),
UNIQUE KEY `user_field__uuid__value` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='The base table for user entities.' |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
答案 0 :(得分:1)
Drupal 7的schema肯定在pass
表格中有一个users
字段。
您可能希望在pass
字段周围使用反引号:
UPDATE users
SET `pass` ='$S$CTo9G7Lx28rzCfpn4WB2hUlknDKv6QTqHaf82WLbhPT2K5TzKzML'
WHERE uid = 1;
如果这不起作用,并且仔细检查MySQL客户端中的表没有显示字段,我会担心有人无意中删除了它。不过,这个数据库结构可以在Drupal 8中看到,所以请仔细检查你的版本。
答案 1 :(得分:0)
Drupal 7和Drupal 8有不同的表格和架构。
这些说明适用于Drupal 7.如果pass
表中没有users
且您有users_field_data
you need to find the other instructions for Drupal 8.
提示它非常简单
您正在更改表名,users_field_data
实际上是正确的表格。
UPDATE users_field_data
SET pass= hash_generated_with_password-hash.sh
WHERE uid = 1;
此外,您必须删除缓存
DELETE FROM cache_entity
WHERE cid = 'values:user:1';
答案 2 :(得分:0)
尝试使用drush重置密码
drush upwd USERNAME PASSWORD