溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

02-influxdb的權(quán)限管理

發(fā)布時間:2020-07-05 11:27:04 來源:網(wǎng)絡(luò) 閱讀:3767 作者:qq850900633 欄目:數(shù)據(jù)庫
  • 01-InfluxDB介紹請?zhí)砑渔溄用枋?/p>

  • 02-influxdb的權(quán)限管理

  • 03-Influxdb的備份與恢復(fù)

介紹

其實influxdb的權(quán)限語法和mysql基本相似,看完以后你基本就能了解;

授權(quán)語法

  1. 創(chuàng)建用戶:CREATE USER <username> WITH PASSWORD '<password>'
  2. 授權(quán)權(quán)限:GRANT [READ,WRITE,ALL] ON <database_name> TO <username>
  3. 創(chuàng)建并授權(quán):CREATE USER <username> WITH PASSWORD '<password>' WITH ALL PRIVILEGES
  4. 取消授權(quán):REVOKE ALL PRIVILEGES FROM <username>
  5. 修改密碼:SET PASSWORD FOR <username> = '<password>'
  6. 刪除用戶:DROP USER <username>

開啟登錄認證
vim /etc/influxdb/influxdb.conf

[http]
auth-enabled = true

[root@localhost tmp]# influx

Connected to http://localhost:8086 version 1.7.1
InfluxDB shell version: 1.7.1
Enter an InfluxQL query
> show databases
ERR: unable to parse authentication credentials
Warning: It is possible this error is due to not setting a database.
Please set a database with the command "use <database>".
> auth
username: monitor
password:
> show databases
name: databases
name
----
_internal
zabbix
telegraf
chronograf
> quit

授權(quán)操作

1.創(chuàng)建超級用戶
創(chuàng)建用戶:monitor
密碼:zabbix
權(quán)限:全部權(quán)限(超級用戶)
create user monitor with password 'zabbix' with all privileges

2.創(chuàng)建只讀用戶
用戶:monitor_ro
數(shù)據(jù)庫:monitordb
權(quán)限:指定數(shù)據(jù)庫的只讀權(quán)限

create user monitor_ro with password 'zabbix_apipwd'
grant read on monitordb to monitor_ro

3.創(chuàng)建可以寫用戶
用戶:monitor_rw
數(shù)據(jù)庫:monitordb
權(quán)限:指定數(shù)據(jù)庫的寫權(quán)限

create user monitor_rw with password 'zabbix_apipwd'
grant write on monitordb to monitor_rw

4.取消用戶授權(quán)
取消用戶授權(quán):

REVOKE ALL PRIVILEGES FROM monitor_rw

5.查看所有用戶

SHOW USERS
user admin


monitor true
monitor_ro false
monitor_rw false

6.刪除用戶

DROP USER monitor_rw

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI