[ZBX-17801] Zabbix Server cannot connect to mysql DB Created: 2020 May 25  Updated: 2024 Apr 10  Resolved: 2020 Jun 11

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Proxy (P), Server (S)
Affects Version/s: 4.0.21rc1, 4.4.9rc1, 5.0.1rc1
Fix Version/s: 4.0.22rc1, 4.4.10rc1, 5.0.2rc1, 5.2.0alpha1, 5.2 (plan)

Type: Problem report Priority: Critical
Reporter: Jurijs Klopovskis Assignee: Artjoms Rimdjonoks
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Causes
caused by ZBX-15484 Zabbix proxy can wait long time if in... Closed
Team: Team C
Sprint: Sprint 64 (May 2020), Sprint 65 (Jun 2020)
Story Points: 0.5

 Description   

Zabbix Server fails to start on CentOS 8 with mysql server with the following error.

[Z3001] connection to database 'zabbix' failed: [1227] Access denied; you need (at least one of) the SUPER, SYSTEM_VARIABLES_ADMIN or SESSION_VARIABLES_ADMIN privilege(s) for this operation

Presumably caused by 90d0172d5d commit.

Install zabbix from packages to reproduce.
https://www.zabbix.com/download?zabbix=4.0&os_distribution=centos&os_version=8&db=mysql&ws=apache

Use mysql server that comes with the distribution.

dnf install mysql-server

 Tested with SELinux and firewalld disabled.



 Comments   
Comment by Vladislavs Sokurenko [ 2020 May 28 ]

Can we select global variable value and change session variable only if global variable is of incorrect value ? And maybe don't set session variable our selves but only show warning

<arimdjonoks>
1) <sasha> suggested that we should not use the global variables in the library functions and advised to use functions to set local static variables instead.
2) We need to set the session variables ourselves since there is no other way we could shadow global session variables.
Users can easily miss the warning and then spend time trying to find why proxy hangs. Failing to start a proxy looks a simple and safe solution as this problem (mysql enforcing session variable access control) is very limited (only proxy used with mysql versions 8.0.14-8.0.17 are affected, the error is easy to recover from, issue is documented in the known issues ).

vso by global variable I mean:

select @@GLOBAL.auto_increment_increment;

arimdjonoks
The original problem ZBX-15484 was caused by a user already having global variables(used by their non-zabbix systems). We cannot just override them for zabbix.

Comment by Artjoms Rimdjonoks [ 2020 Jun 01 ]

Available in versions:

Updated documentation:

Comment by gofree [ 2020 Jun 07 ]

this was also hapenning when updating zabbix proxy to 5.0.1 (from 5.0.0 ) on mysql from rpm packages on centos8
<arimdjonoks> MySQL in some versions (8.0.14-8.0.17) requires extra privileges to set the increment options. This issue soon will be added to the known issues, but essentially you can either upgrade to use MySQL to the higher version than 8.0.17 or just grant zabbix this privilege:

grant SESSION_VARIABLES_ADMIN on *.* to 'zabbix'@'localhost';
Comment by gofree [ 2020 Jun 08 ]

thanks - the grant did solve it on proxy ( mysql version 8.0.17 )

Generated at Mon Apr 28 09:11:46 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.