重置zabbix系统的登录密码

一、需要连接到zabbix的mysql的数据库。

1.如果忘记mysql的密码可以通过以下命令进行查询到zabbix的配置文件在配置文件内查看。

find / -name zabbix_server.conf 

[root@zabbix-server ~]# find / -name zabbix_server.conf
/etc/zabbix/zabbix_server.conf

查看配置文件找到DBPassword=XXXXXX      这里的XXXXX就是数据库的密码

[root@zabbix-server ~]# cat /etc/zabbix/zabbix_server.conf
.............
.............
### Option: DBSchema
#       Schema name. Used for PostgreSQL.
#
# Mandatory: no
# Default:
# DBSchema=

### Option: DBUser
#       Database user.
#
# Mandatory: no
# Default:
# DBUser=

DBUser=zabbix

### Option: DBPassword
#       Database password.
#       Comment this line if no password is used.
#
# Mandatory: no
# Default:
DBPassword=Qianfeng@123
..............
..............
..............

2.登录到数据库内

[root@zabbix-server ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 806
Server version: 5.7.42 MySQL Community Server (GPL)

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

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>

3.修改zabbix的登录密码,具体如下

>select user(); 查看当前用户
+----------------+
| user()         |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| zabbix             |
+--------------------+
5 rows in set (0.01 sec)

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> select * from users;   查看admin账户名,可能是admin也可能是Admin

+--------+-------+--------+---------------+--------------------------------------------------------------+-----+-----------+------------+-------+---------+------+---------+----------------+--------------+---------------+---------------+
| userid | alias | name   | surname       | passwd                                                       | url | autologin | autologout | lang  | refresh | type | theme   | attempt_failed | attempt_ip   | attempt_clock | rows_per_page |
+--------+-------+--------+---------------+--------------------------------------------------------------+-----+-----------+------------+-------+---------+------+---------+----------------+--------------+---------------+---------------+
|      1 | Admin | Zabbix | Administrator | $2y$10$QRkPJLYYJsQ20skG1UQOSeDZjYPCb3a.MUpSTMGL6zUKvGUAZrWDa |     |         1 | 0          | zh_CN | 30s     |    3 | default |              2 | 192.168.46.1 |    1700487686 |            50 |
|      2 | guest |        |               | $2y$10$89otZrRNmde97rIyzclecuk6LwKAsHN0BcvoOKGjbT.BwMBfm7G06 |     |         0 | 15m        | en_GB | 30s     |    1 | default |              0 |              |             0 |            50 |
+--------+-------+--------+---------------+--------------------------------------------------------------+-----+-----------+------------+-------+---------+------+---------+----------------+--------------+---------------+---------------+
2 rows in set (0.00 sec)

>UPDATE user SET password=PASSWORD('新密码') WHERE user='用户';

例如: update users set passwd= md5('zabbix') where alias='Admin';

mysql> flush privileges;      刷新一下
Query OK, 0 rows affected (0.00 sec)

mysql> \q
Bye

  • 10
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值