Oceanbase数据库新建库和用户

建库和用户需要使用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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

七七powerful

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值