在test_tenant租户上创建用户、赋予权限和创建数据库,然后使用该用户登录数据库,创建表、修改表等操作。通过具体实验,了解、熟悉OB4.0数据的使用。
[root@node1 ~]# obclient -h127.0.0.1 -P2881 -uroot@test_tenant -A
Welcome to the OceanBase. Commands end with ; or \g.
Your OceanBase connection id is 3221513609
Server version: OceanBase_CE 4.0.0.0 (r103000022023011215-05bbad0279302d7274e1b5ab79323a2c915c1981) (Built Jan 12 2023 15:28:27)
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 [(none)]> CREATE USER 'test_user' IDENTIFIED BY 'test_user';
Query OK, 0 rows affected (4.219 sec)
obclient [(none)]> grant all on *.* to test_user;
Query OK, 0 rows affected (2.188 sec)
obclient [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| oceanbase |
| test |
+--------------------+
4 rows in set (0.019 sec)
[root@node1 ~]# obclient -h127.0.0.1 -P2881 -utest_user@test_tenant -ptest_user
Welcome to the OceanBase. Commands end with ; or \g.
Your OceanBase connection id is 3221513610
Server version: OceanBase_CE 4.0.0.0 (r103000022023011215-05bbad0279302d7274e1b5ab79323a2c915c1981) (Built Jan 12 2023 15:28:27)
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 [(none)]> create database test_db default character set utf8mb4;
Query OK, 1 row affected (3.890 sec)
obclient [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |