A Zabbix database must be created during the installation of Zabbix server or proxy.
This section provides instructions for creating a Zabbix database. A separate set of instructions is available for each supported database.
data.sql files are located in the database subdirectory of Zabbix sources. If Zabbix was installed from distribution packages, refer to the distribution documentation.
For a Zabbix proxy database, only
schema.sql should be imported (no images.sql nor data.sql)
If installing from Zabbix Git repository, you need to run:
$ make dbschema
prior to proceeding to the next steps.
shell> mysql -uroot -p<password> mysql> create database zabbix character set utf8 collate utf8_bin; mysql> grant all privileges on zabbix.* to [email protected] identified by '<password>'; mysql> quit;
You need to have database user with permissions to create database objects. The following shell command will create user
zabbix. Specify password when prompted and repeat password (note, you may first be asked for
Now we will set up the database
zabbix (last parameter) with the previously created user as the owner (
-O zabbix) and import initial schema and data (assuming you are in the root directory of Zabbix sources):
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.
We assume that a zabbix database user with password password exists and has permissions to create database objects in ORCL service located on the host Oracle database server with a user shell user having write access to /tmp directory. Zabbix requires a Unicode database character set and a
UTF8 national character set. Check current settings:
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:
shell> cd /path/to/zabbix-sources shell> ssh [email protected]_host "mkdir /tmp/zabbix_images" shell> scp -r misc/images/png_modern [email protected]_host:/tmp/zabbix_images/
Now prepare the database:
shell> cd /path/to/zabbix-sources/database/oracle shell> sqlplus zabbix/[email protected]_host/ORCL sqlplus> @schema.sql # stop here if you are creating database for Zabbix proxy sqlplus> @images.sql sqlplus> @data.sql
Now the temporary directory can be removed:
shell> ssh [email protected]_host "rm -rf /tmp/zabbix_images"
It is important to set UTF-8 locale for Zabbix server, Zabbix proxy and the web server running Zabbix frontend. Otherwise text information from Zabbix will be interpreted by IBM DB2 server as non-UTF-8 and will be additionally converted on the way from Zabbix to the database and back. The database will store corrupted non-ASCII characters.
Zabbix frontend uses
LIMIT clauses in SQL queries. For this to work, IBM DB2 server must have DB2_COMPATIBILITY_VECTOR variable be set to 3. Run the following command before starting the database server:
Using SQLite is supported for Zabbix proxy only!
If using SQLite with Zabbix proxy, database will be automatically created if it does not exist.
Return to the installation section.
In some cases, Zabbix might generate non-optimized queries to the database. This may happen, for example, as a result of using an older database version.
Additional DB patches are available for resolving such issues on the specific database or, sometimes, a specific database version. See [Known issues|/manual/installation/known_issues#slow-mysql-queries] for the list of known problems and available patches.