Mark
Mark

Reputation: 21

Connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)

I'am the new user of zabbix. After updating zabbix (from Zabbix 4.0.8 to Zabbix 4.2.5) I had a problem with web-interface.

The frontend does not match Zabbix database. Current database version (mandatory/optional): 4000000/4000006. Required mandatory version: 4020000. Contact your system administrator.

I opened a log file and found:

10344:20221123:151903.222 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)
 10344:20221123:151903.222 database is down: reconnecting in 10 seconds

I checked /usr/share/zabbix/conf/zabbix.conf.php

global $DB;

$DB['TYPE']     = 'MYSQL';
$DB['SERVER']   = 'localhost';
$DB['PORT']     = '0';
$DB['DATABASE'] = 'zabbix';
$DB['USER']     = 'zabbix';
$DB['PASSWORD'] = 'password';

// Schema name. Used for IBM DB2 and PostgreSQL.
$DB['SCHEMA'] = '';

$ZBX_SERVER      = 'localhost';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = 'zabbix-test';

$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;

If I login in mysql with password, it works.

mysql -u zabbix -h localhost --database=zabbix -p

Without password it doesn't work.

mysql -u zabbix -h localhost --database=zabbix
ERROR 1045 (28000): Access denied for user 'zabbix'@'localhost' (using password: NO)

As I understand, the problem is that zabbix doesn't use the password during logining.

I have tried:

mysql> grant all privileges on zabbix.* to zabbix@localhost;

Tried to update proxy:

apt-get install --only-upgrade zabbix-proxy-mysql

0 upgraded, 0 newly installed, 0 to remove and 109 not upgraded.

Upvotes: 1

Views: 26186

Answers (2)

Acauã Pitta
Acauã Pitta

Reputation: 760

Following the tutorial:

Zabbix 6.4 For Ubuntu

I came to this...

after installing and reinstalling MySQL several times I noticed that I copy and paste this line:

mysql> create user zabbix@localhost identified by 'password';

so, I was trying to insert my SQL password but had set it to 'password'.

Updating that line works fine.

Upvotes: 0

Mark
Mark

Reputation: 21

zabbix_server.conf has been changed after updating of zabbix. I found out that my DB password was commented out.

  DBUser=zabbix

### Option: DBPassword
#       Database password.
#       Comment this line if no password is used.
#
# Mandatory: no
# Default:
# DBPassword

I wrote the password and it works.

DBPassword=yourpassword

Upvotes: 0

Related Questions