Oceanbase 数据库业务租户的密码忘记咋办?

1、mysql租户的root密码忘记了?

创建租户时root密码登记后找不到了,遇到这个问题,查看相关文档,并没有找到相关的方法可以修改

#mysql租户下有权限高的用户可以修改root@'%'密码
必须要有alter create user权限才可以修改

[root@OCP ~]# mysql -hx.x.x.x -P2881 -uroot@test_mysql   -paaAA11__ -cA
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 3221555081
Server version: 5.7.25 OceanBase 4.2.1.10 (r110000072024111216-17254329f8916c159fa250e86b0f4ef467da92c7) (Built Nov 12 2024 16:36:59)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> 
MySQL [(none)]> 
MySQL [(none)]> 
MySQL [(none)]> QUIT;
Bye
[root@OCP ~]# 
[root@OCP ~]# 
[root@OCP ~]# mysql --hx.x.x.x  -P8800 -ulss@test_mysql#test -paaAA11__ 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 92494
Server version: 5.6.25 OceanBase 4.2.1.10 (r110000072024111216-17254329f8916c159fa250e86b0f4ef467da92c7) (Built Nov 12 2024 16:36:59)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> quit;
Bye
[root@OCP ~]# 
[root@OCP ~]# mysql --hx.x.x.x  -P8800 -ulss@test_mysql#test -paaAA11__ 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 89916
Server version: 5.6.25 OceanBase 4.2.1.10 (r110000072024111216-17254329f8916c159fa250e86b0f4ef467da92c7) (Built Nov 12 2024 16:36:59)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> 
MySQL [(none)]> alter user root@'%' identified by 'aaAA11++';
Query OK, 0 rows affected (0.198 sec)

MySQL [(none)]> quit;
Bye
[root@OCP ~]# 
[root@OCP ~]# mysql --hx.x.x.x  -P2881 -uroot@test_mysql   -paaAA11__ -cA
ERROR 1045 (42000): Access denied for user 'root'@'xxx.xxx.xxx.xxx' (using password: YES)
[root@OCP ~]# 
[root@OCP ~]# mysql --hx.x.x.x  -P2881 -uroot@test_mysql   -paaAA11++  -cA
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 3221563178
Server version: 5.7.25 OceanBase 4.2.1.10 (r110000072024111216-17254329f8916c159fa250e86b0f4ef467da92c7) (Built Nov 12 2024 16:36:59)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> 
MySQL [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| oceanbase          |
| test               |
+--------------------+
4 rows in set (0.005 sec)

MySQL [(none)]> quit;
Bye
[root@OCP ~]# mysql -hx.x.x.x  -P8800 -ulss@test_mysql#test -paaAA11__ 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 84220
Server version: 5.6.25 OceanBase 4.2.1.10 (r110000072024111216-17254329f8916c159fa250e86b0f4ef467da92c7) (Built Nov 12 2024 16:36:59)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> show grants for lss;
+--------------------------------------------------+
| Grants for lss@%                                 |
+--------------------------------------------------+
| GRANT ALTER, CREATE, CREATE USER ON *.* TO 'lss' |
| GRANT ALL PRIVILEGES ON `test`.* TO 'lss'        |
| GRANT SELECT ON `mysql`.* TO 'lss'               |
| GRANT SELECT ON `oceanbase`.* TO 'lss'           |
+--------------------------------------------------+
4 rows in set (0.013 sec)

MySQL [(none)]> quit;

 2、oracle租户的SYS密码忘记了? 

oracle 租户下其它用户必须要有DBA权限

[root@OCP ~]# obclient -h10.19.37.125 -P8800 -uLSS@test#test -paaAA11__  -cA
Welcome to the OceanBase.  Commands end with ; or \g.
Your OceanBase connection id is 84621
Server version: OceanBase 4.2.1.10 (r110000072024111216-17254329f8916c159fa250e86b0f4ef467da92c7) (Built Nov 12 2024 16:36:59)

Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

obclient(LSS@test)[LSS]> quit;
Bye

[root@OCP ~]# obclient -h10.19.37.125 -P8800 -uSYS@test#test -paaAA11++  -cA
Welcome to the OceanBase.  Commands end with ; or \g.
Your OceanBase connection id is 91214
Server version: OceanBase 4.2.1.10 (r110000072024111216-17254329f8916c159fa250e86b0f4ef467da92c7) (Built Nov 12 2024 16:36:59)

Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

obclient(SYS@test)[SYS]> 
obclient(SYS@test)[SYS]> 
obclient(SYS@test)[SYS]> QUIT;
Bye
[root@OCP ~]# 
[root@OCP ~]# obclient -h10.19.37.125 -P8800 -uLSS@test#test -paaAA11__  -cA
Welcome to the OceanBase.  Commands end with ; or \g.
Your OceanBase connection id is 84695
Server version: OceanBase 4.2.1.10 (r110000072024111216-17254329f8916c159fa250e86b0f4ef467da92c7) (Built Nov 12 2024 16:36:59)

Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

obclient(LSS@test)[LSS]> ALTER USER SYS IDENTIFIED BY "aaAA11__";
Query OK, 0 rows affected (0.062 sec)

obclient(LSS@test)[LSS]> QUIT;
Bye
[root@OCP ~]# obclient -h10.19.37.125 -P8800 -uSYS@test#test -paaAA11++  -cA
ERROR 1045 (42000): Access denied for user 'SYS'@'xxx.xxx.xxx.xxx' (using password: YES)
[root@OCP ~]# 
[root@OCP ~]# 
[root@OCP ~]# obclient -h10.19.37.125 -P8800 -uSYS@test#test -paaAA11__  -cA
Welcome to the OceanBase.  Commands end with ; or \g.
Your OceanBase connection id is 91489
Server version: OceanBase 4.2.1.10 (r110000072024111216-17254329f8916c159fa250e86b0f4ef467da92c7) (Built Nov 12 2024 16:36:59)

Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

obclient(SYS@test)[SYS]> 
obclient(SYS@test)[SYS]> SELECT * FROM DBA_ROLE_PRIVS WHERE grantee = 'LSS';
+---------+--------------+--------------+--------------+
| GRANTEE | GRANTED_ROLE | ADMIN_OPTION | DEFAULT_ROLE |
+---------+--------------+--------------+--------------+
| LSS     | CONNECT      | NO           | YES          |
| LSS     | DBA          | NO           | YES          |
+---------+--------------+--------------+--------------+
2 rows in set (0.072 sec)

obclient(SYS@test)[SYS]> quit;
Bye

  

 

 

 

 

 
 
posted @ 2026-05-09 11:02  Linux运维-Friend  阅读(3)  评论(0)    收藏  举报