19.5 忘记Admin密码如何作

忘记Admin密码如何作

  • 进入mysql命令行,选择zabbix库
  • mysql -uroot -p zabbix
  • update users set passwd=md5(‘newpasswd’) where alias=‘Admin’;
  • 这样就更改了Admin用户的密码

忘记zabbix密码

  • 有时由于时间长了,zabbix管理员帐号密码给忘记了
  • 解决办法:
    • 重置zabbix密码,就是直接更改数据库里的数据便可
  1. 首先进入到mysql命令行里面
A机器
[root@hf-01 ~]# mysql -uroot -phanfeng
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 342
Server version: 5.6.35 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql>
  1. 使用zabbix库
mysql> use zabbix
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql>
  1. 查看zabbix相关的表,之后服务器监控的主机越多,那么这些表会愈来愈大,因此须要去指定合适的监控策略
  • 好比说:数据量须要保存多长时间,那么在定义这个监控项目的时候就该想到,要保留1个月仍是1年,仍是其余时间;
  • 好比,监控的站点服务量很大的话,一天就要涨好几个G,那么你的服务器磁盘能支持保存多长时间;
show tables;
  1. zabbix的密码,默认存放的表是users里面
  2. 查看users表
  • desc users;
mysql> desc users;
+----------------+---------------------+------+-----+---------+-------+
| Field          | Type                | Null | Key | Default | Extra |
+----------------+---------------------+------+-----+---------+-------+
| userid         | bigint(20) unsigned | NO   | PRI | NULL    |       |
| alias          | varchar(100)        | NO   | UNI |         |       |
| name           | varchar(100)        | NO   |     |         |       |
| surname        | varchar(100)        | NO   |     |         |       |
| passwd         | char(32)            | NO   |     |         |       |
| url            | varchar(255)        | NO   |     |         |       |
| autologin      | int(11)             | NO   |     | 0       |       |
| autologout     | int(11)             | NO   |     | 900     |       |
| lang           | varchar(5)          | NO   |     | en_GB   |       |
| refresh        | int(11)             | NO   |     | 30      |       |
| type           | int(11)             | NO   |     | 1       |       |
| theme          | varchar(128)        | NO   |     | default |       |
| attempt_failed | int(11)             | NO   |     | 0       |       |
| attempt_ip     | varchar(39)         | NO   |     |         |       |
| attempt_clock  | int(11)             | NO   |     | 0       |       |
| rows_per_page  | int(11)             | NO   |     | 50      |       |
+----------------+---------------------+------+-----+---------+-------+
16 rows in set (0.01 sec)

mysql>
  • 须要修改的就是passwd的表
  1. 修改密码
  • update users set passwd=md5(‘newpasswd’) where alias=‘Admin’;
mysql> update users set passwd=md5('aminglinux') where alias='Admin';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql>
  1. 查看表的状况
  • select * from users\G;
mysql> select * from users\G;
*************************** 1. row ***************************
        userid: 1
         alias: Admin
          name: Zabbix
       surname: Administrator
        passwd: 683cb8e76a8889fdc5161e3fa7e51f2d
           url: 
     autologin: 1
    autologout: 0
          lang: zh_CN
       refresh: 30
          type: 3
         theme: default
attempt_failed: 0
    attempt_ip: 
 attempt_clock: 0
 rows_per_page: 50
*************************** 2. row ***************************
        userid: 2
         alias: guest
          name: 
       surname: 
        passwd: d41d8cd98f00b204e9800998ecf8427e
           url: 
     autologin: 0
    autologout: 900
          lang: en_GB
       refresh: 30
          type: 1
         theme: default
attempt_failed: 0
    attempt_ip: 
 attempt_clock: 0
 rows_per_page: 50
2 rows in set (0.00 sec)

ERROR: 
No query specified

mysql>
  1. 修改之后就能够去尝试用新密码登陆zabbix了,这就是充值zabbix管理员密码
相关文章
相关标签/搜索