How to install and configure MySQL for Zabbix on Ubuntu 18.04 ?

The latest release for zabbix is 3.4, we’re going to see together how to configuring mysql for zabbix on Ubuntu 18.04.

I will divide the tutorial into 3 parts so that I can detail the different procedures.


First time, we need an virtual machine with Ubuntu 18.04 for install MySQL Server and know the future IP address of web servers zabbix.

Add a second disk of 20Go for server1, to put the SQL data, the second disk must be mounted in /srv .

  • zabbix-sql01 –
  • zabbix-web01 –
  • zabbix-web02 –
  • zabbix-web-vip –

Installation MySQL Server

Step 1 — Installing MySQL

The latest version of mySQL on Ubuntu 18.04 is MySQL 5.7 when i write this.

Step 2 — Secure Mysql

This program enables you to improve the security of your MySQL installation in the following ways

  • You can set a password for root accounts.
  • Remove root accounts that are accessible from outside the local host.
  • Also remove anonymous-user accounts.
  • And remove the test database (which by default can be accessed by all users, even anonymous users), and privileges that permit anyone to access databases with names that start with test_.

For more information, please read the reference manual of MySQL.

Change a MySQL Data Directory to a New Location Using a Symlink

I like this method for change location of MySQL Data Directory. You have other methods but i explain this.

Step 1 — Moving the MySQL Data Directory

First, Shutdown MySQL service

Then, Check the status of MySQL service

And, Move Data Directory

To finish, create a symlink

Step 2 — Configuring AppArmor Access Control Rules

To add the alias, edit the AppArmor alias file

add the line

for apply the modification restart apparmor

Step 3 — Remote MySQL

Open the configuration file in /etc/mysql/mysql.conf.d/mysqld.cnf

Please comment the line : bind-address

Save and close the file.

Restart the Mysql Server

Create initial database

Connect in your mysql server and tape the command to identify

Create Zabbix database and user on MySQL by the following commands,

Now import schema, images and data in mysql

Your server mysql is ready for zabbix server and web front. You have possibility to create a second server MySQL to have resilience (Master-Slave) on your database.

You can follow this tutorial to configure Master-Slave with MySQL Server : How to set up Master-Slave replication in MySQL

Leave a reply:

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Site Footer