X

How To Change Zabbix Database Name

Zabbix database is very important. If you want to change the Zabbix database name.  All the data on the Zabbix server is in its database. So the Zabbix database is very important. Then follow the steps below.

Send Mail Notification From Zabbix Server Using Gmail
How To Upgrade Zabbix Server From 3.2.6 To 3.4.1

Step #01: First, stop all the Zabbix services and then backup the database.

root@zabbix-server:~# service zabbix-server stop
root@zabbix-server:~# service zabbix-agent stop
root@zabbix-server:~# service zabbix-java-gateway stop

Step #02: Now back up your running database.

root@zabbix-server:~# mysqldump -u root -p zabbix_old > zabbix_old.sql

Type mysql root password for database backup.

Step #03: Now goto mysql and create new database name command below.

root@zabbix-server:~# mysql -u root -p

Type mysql root password.

Create new database with grant privilege.

mysql> create database zabbix_new character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix_new.* to zabbix_user@localhost identified by 'passw0rd';
mysql> flush privileges;
      cd database/mysql
       mysql -uzabbix_user -ppassw0rd zabbix_new < schema.sql
       mysql -uzabbix_user -ppassw0rd zabbix_new < images.sql
       mysql -uzabbix_user -ppassw0rd zabbix_new < data.sql
\q

Step #04: The backup Zabbix database will be restored to the new database.

root@zabbix-server:~# mysql -u root -p zabbix_new < zabbix_old.sql

Step #05: Database information is provided in two files. A file is a zabbix_server.conf config file and the other is a web zabbix.conf.php config file.

Now open and change new database information like as database name, database user and database password.

This is web config file.

root@zabbix-server:~# vi /etc/zabbix/web/zabbix.conf.php

Like as example below.

$DB['TYPE'] = 'MYSQL';
$DB['SERVER'] = 'localhost';
$DB['PORT'] = '0';
$DB['DATABASE'] = 'zabbix_new';
$DB['USER'] = 'zabbix_user';
$DB['PASSWORD'] = 'passw0rd';

And other config file.

root@zabbix-server:~# vi /etc/zabbix/zabbix_server.conf

Server config details below

DBName=zabbix_new
DBUser=zabbix_user
DBPassword=passw0rd

All settings are complete now starting services.

root@zabbix-server:~# service zabbix-server start 
root@zabbix-server:~# service zabbix-agent start 
root@zabbix-server:~# service zabbix-java-gateway start

Goto your browser and access via admin login.

Zabbix default user name and password:

User Name : Admin (‘A’ must be use capital)

Password : zabbix ( You can change any time)

If you need, you can see another post.

How To Check Mikrotik Router SNMP Service From Zabbix Server

Check Web Site URL From Zabbix Server

Zabbix Troubleshooting Tips

0 0 votes
Article Rating
Admin: I am system administrator as Windows and Linux platform. I have 4 years skilled from the professional period. I have to configure Linux based system such as an Asterisk VOIP system, Network monitoring tools (ZABBIX), Virtualization (XEN Server), Cloud computing (Apache CloudStack) etc. Now share my professional skill each interested person. Thanks to all.
Leave a Comment