19.5 忘记Admin密码如何做

时间:2022-04-27
本文章向大家介绍19.5 忘记Admin密码如何做,主要内容包括忘记Admin密码如何做、忘记zabbix密码、基本概念、基础应用、原理机制和需要注意的事项等,并结合实例形式分析了其使用技巧,希望通过本文能帮助到大家理解应用这部分内容。

忘记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 usersG;
mysql> select * from usersG;
*************************** 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管理员密码