建库和用户需要使用root进行连接。
[admin@ensbrain observer01]$ mysql -h127.1 -uroot@mysql01#obcluster -P2883 -p'密码' -c -A
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 139881
Server version: 5.6.25 OceanBase 3.1.1 (r20210508100750-b47c8fdd84ca9281ec7cb0122ad8962aaa55e21a) (Built May 8 2021 10:37:40)
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 databases;
+--------------------+
| Database |
+--------------------+
| oceanbase |
| information_schema |
| mysql |
| test |
| yewu |
| aespess |
| aespnative |
+--------------------+
7 rows in set (0.007 sec)
MySQL [(none)]> select user,host from mysql.user;
+------------+------+
| user | host |
+------------+------+
| root | % |
| ORAAUDITOR | % |
| qyq | % |
| aespess | % |
+------------+------+
4 rows in set (0.018 sec)
MySQL [(none)]> create database log_collect; //创建数据库
Query OK, 1 row affected (0.026 sec)
MySQL [(none)]> create user collect@'%' identified by '密码'; //创建用户
Query OK, 0 rows affected (0.021 sec)
MySQL [(none)]> grant all privileges on log_collect.* to collect@'%'; //授权
Query OK, 0 rows affected (0.015 sec)
MySQL [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| oceanbase |
| information_schema |
| mysql |
| test |
| yewu |
| aespess |
| aespnative |
| log_collect |
+--------------------+
8 rows in set (0.006 sec)
MySQL [(none)]>
MySQL [(none)]> select user,host from mysql.user;
+------------+------+
| user | host |
+------------+------+
| root | % |
| ORAAUDITOR | % |
| qyq | % |
| aespess | % |
| collect | % |
+------------+------+
5 rows in set (0.007 sec)
mysql -h127.1 -ucollect@mysql01#obcluster -P2883 -p'密码' -c -A log_collect
Oceanbase数据库新建库和用户
最新推荐文章于 2024-09-18 10:28:11 发布