ODP-Sharding 控制台无法直接修改 admin 用户的密码,本文总结如何通过修改 meta 库修改 admin 用户密码。
通过控制台修改密码时会提示错误 user 0000011 role is an administrator, please use the administrator role to modify the administrator identity information in the global configuration function。
可以通过以下步骤修改 admin 用户:
通过 ODP meta 租户连接到 metadb 集群。
开启鉴权。
obclient [(none)]> use dbpconsole_db; Database changedobclient [dbpconsole_db]> update zdalproxy_config set config_value='true' where config_key='global_auth_check'; Query OK, 0 rows affected (0.01 sec) Rows matched: 1 Changed: 0 Warnings: 0obclient [dbpconsole_db]> select * from dbpconsole_db.zdalproxy_config where `config_key`='global_auth_check'; +-----+---------------------+---------------------+------------+----------+-------------------+--------------+------------------------------------------------------+ | id | gmt_create | gmt_modified | env_tenant | env_mode | config_key | config_value | description | +-----+---------------------+---------------------+------------+----------+-------------------+--------------+------------------------------------------------------+ | 242 | 2023-09-13 15:55:50 | 2023-09-13 15:55:50 | - | - | global_auth_check | true | 是否需要权限校验,不加配置相当于true | +-----+---------------------+---------------------+------------+----------+-------------------+--------------+------------------------------------------------------+插入密码配置项。
obclient [dbpconsole_db]> INSERT INTO `zdalproxy_config`(`gmt_create`, `gmt_modified`, `env_tenant`, `env_mode`, `config_key`, `config_value`, `description`) VALUES (now(), now(), '-', '-', 'global_embedded_user_info_key', '[{"userId":"0000011","username":"admin","password":"xxxxxx"}]', '修改密码'); Query OK, 1 row affected (0.01 sec)obclient [dbpconsole_db]> select * from zdalproxy_config order by id desc limit 1; +---------+---------------------+---------------------+------------+----------+-------------------------------+--------------------------------------------------------------------+--------------+ | id | gmt_create | gmt_modified | env_tenant | env_mode | config_key | config_value | description | +---------+---------------------+---------------------+------------+----------+-------------------------------+--------------------------------------------------------------------+--------------+ | 2000317 | 2023-09-19 10:50:06 | 2023-09-19 10:50:06 | - | - | global_embedded_user_info_key | [{"userId":"0000011","username":"admin","password":"xxxxxx"}] | 修改密码 | +---------+---------------------+---------------------+------------+----------+-------------------------------+--------------------------------------------------------------------+--------------+ 1 row in set (0.01 sec)修改密码或增加用户与步骤 3 类似。
obclient [dbpconsole_db]> update zdalproxy_config set config_value='[{"userId":"000001","username":"admin","password":"xxxxxx"},{"userId":"000002","username":"test","password":"xxxxxx"}]' where config_key='global_embedded_user_info_key'; Query OK, 1 row affected (0.02 sec) Rows matched: 1 Changed: 1 Warnings: 0
适用版本
ODP Sharding 所有版本