Zabbix の Admin パスワードを忘れた場合 - aktnk/til GitHub Wiki

zabbixのデータを管理するデータベースzabbix内のusersテーブルにあるusernameがAdminのpasswdを'5fce1b3e34b520afeffb37ce08c7cd66'に更新することで、デフォルトのパスワードにすることができる。

  • mysql にサインインする
    $ sudo musql -u root -p
    
  • zabbixデータベースがあることを確認する
    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | performance_schema |
    | sys                |
    | zabbix             |
    +--------------------+
    5 rows in set (0.00 sec)
    
  • 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
    
  • usersテーブルがあるか確認する
    mysql> show tables;
    +----------------------------+
    | Tables_in_zabbix           |
    +----------------------------+
    | acknowledges               |
    | actions                    |
    
          <省略>
    
    | users                      |
    | users_groups               |
    | usrgrp                     |
    | valuemap                   |
    | valuemap_mapping           |
    | widget                     |
    | widget_field               |
    +----------------------------+
    173 rows in set (0.01 sec)
    
  • usersテーブルにAdminが登録されていることを確認する
    mysql> select * from users;
    select * from users;
    +--------+----------+--------+---------------+--------------------------------------------------------------+-----+-----------+------------+---------+---------+---------+----------------+--------------+---------------+---------------+----------+--------+
    | userid | username | name   | surname       | passwd                                                       | url | autologin | autologout | lang    | refresh | theme   | attempt_failed | attempt_ip   | attempt_clock | rows_per_page | timezone | roleid |
    +--------+----------+--------+---------------+--------------------------------------------------------------+-----+-----------+------------+---------+---------+---------+----------------+--------------+---------------+---------------+----------+--------+
    |      1 | Admin    | Zabbix | Administrator | ************************************************************ |     |         1 | 0          | default | 30s     | default |              4 | 192.168.0.91 |    1723883388 |            50 | default  |      3 |
    <省略>
    
  • Adminのpasswdを初期化する
    mysql> UPDATE users SET passwd='5fce1b3e34b520afeffb37ce08c7cd66' WHERE username = 'Admin';
    Query OK, 1 row affected (0.01 sec)
    Rows matched: 1  Changed: 1  Warnings: 0
    
  • mysqlから抜ける
    mysql> quit;
    Bye
    $