Zabbix web page login and forget the user name and password solution

Situation 1

: After setting up the Zabbix server, beginners use the browser to log in to the Web page for initialization, as shown in the following figure: After

Insert picture description here


entering the default user name "Admin" and the default password "zabbix", the password may be incorrect.

Situation 2

: Just set up the zabbix server, then added a new user, and disabled the default Admin. Then the monitoring page remained unclosed for more than 10 days. Today, I accidentally closed the browser, and after reopening it, I suddenly forgot my username, which is troublesome.

solution:

1. Enter the zabbix server and connect to the mysql database

[[email protected] ~]# mysql -uroot -p     // -u 后面加用户名,-p 回车,输入数据库密码
Enter password:

2. After entering the mysql database, query the users table

MariaDB [(none)]> use zabbix;

MariaDB [zabbix]> show tables;

MariaDB [zabbix]> select * from users;
+--------+-------+--------+---------------+----------------------------------+-----+-----------+------------+-------+---------+------+---------+----------------+------------+---------------+---------------+
| 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 | io97f44b1235245gffsb2497399d7a93 |     |         1 | 0          | zh_CN | 30s     |    3 | default |              0 | 10.0.0.1   |    1622172999 |            50 |
|      2 | guest |        |               | m41serd98f00b204ekht0098ecf8427e |     |         0 | 15m        | en_GB | 30s     |    1 | default |              0 |            |             0 |            50 |
+--------+-------+--------+---------------+----------------------------------+-----+-----------+------------+-------+---------+------+---------+----------------+------------+---------------+---------------+
2 rows in set (0.00 sec)
注:这里就可以看到当前zabbix用户有哪些了,如果忘记用户名就可以在这里查看

3. Generate a new password of MD5 type, the new password is "123123"

[[email protected] ~]# echo -n  123123  | openssl md5
(stdin)= 4297f44b13955235245b2497399d7a93
# -n参数:不输出尾随换行符
注:一定要存在"-n"参数,否则生成的MD5类型的密码就不是自己指定的密码

4. Then update the users table data

MariaDB [zabbix]> update users set  passwd='4297f44b13955235245b2497399d7a93' where userid = '1';   #修改Admin用户的密码
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

5. Refresh and reload the permission table

MariaDB [zabbix]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.03 sec)

Reference article:
https://www.cnblogs.com/patrick-yeh/p/13039388.html