Overview

    This section provides instructions for creating a Zabbix database. A separate set of instructions is available for each supported database.

    UTF-8 is the only encoding supported by Zabbix. It is known to work without any security flaws. Users should be aware that there are known security issues if using some of the other encodings.

    MySQL

    Character set utf8 and utf8_bin collation is required for Zabbix server/proxy to work properly with MySQL database.

    If you are installing from Zabbix packages, stop here and continue with instructions for or Debian/Ubuntu to import the data into the database.

    If you are installing Zabbix from sources, proceed to import the data into the database. For a Zabbix proxy database, only should be imported (no images.sql nor data.sql):

    1. shell> cd database/mysql
    2. # stop here if you are creating database for Zabbix proxy
    3. shell> mysql -uzabbix -p<password> zabbix < images.sql
    4. shell> mysql -uzabbix -p<password> zabbix < data.sql

    PostgreSQL

    Now we will set up the database zabbix (last parameter) with the previously created user as the owner (-O zabbix).

    If you are installing from Zabbix packages, stop here and continue with instructions for RHEL/CentOS or to import the initial schema and data into the database.

    If you are installing Zabbix from sources, proceed to import the initial schema and data (assuming you are in the root directory of Zabbix sources). For a Zabbix proxy database, only schema.sql should be imported (no images.sql nor data.sql).

    1. shell> cd database/postgresql
    2. shell> cat schema.sql | sudo -u zabbix psql zabbix
    3. # stop here if you are creating database for Zabbix proxy

    The above commands are provided as an example that will work in most of GNU/Linux installations. You can use different commands, e. g. “psql -U <username>” depending on how your system/database are configured. If you have troubles setting up the database please consult your Database administrator.

    TimescaleDB

    Instructions for creating and configuring TimescaleDB are provided in a separate .

    Oracle

    1. sqlplus> select parameter,value from v$nls_parameters where parameter='NLS_CHARACTERSET' or parameter='NLS_NCHAR_CHARACTERSET';

    If you are creating a database for Zabbix server you need to have images from Zabbix sources on the host where Oracle is running. Copy them to a directory /tmp/zabbix_images on the Oracle host:

    Now prepare the database:

    1. shell> cd /path/to/zabbix-sources/database/oracle
    2. shell> sqlplus zabbix/[email protected]_host/ORCL
    3. sqlplus> @schema.sql
    4. # stop here if you are creating database for Zabbix proxy
    5. sqlplus> @images.sql

    Please set the initialization parameter CURSOR_SHARING=FORCE for best performance.

    Now the temporary directory can be removed:

    1. shell> ssh [email protected]_host "rm -rf /tmp/zabbix_images"

    SQLite

    Using SQLite is supported for Zabbix proxy only!

    Return to the installation section.