Cannot connect to the database. –Error connecting to database.

环境 : Ubuntu 16

报错信息 :
Cannot connect to the database.
–Error connecting to database.

Cannot connect to the database. –Error connecting to database._第1张图片
登录postgresql数据库
#su - postgresql
查看postgresql日志
$cat logfile
Cannot connect to the database. –Error connecting to database._第2张图片

问题二 Error connecting to database.

重启虚拟机之后,zabbix server界面打不开了
Cannot connect to the database. –Error connecting to database._第3张图片
解决办法:
cat /var/log/zabbix/zabbix_server.log
Cannot connect to the database. –Error connecting to database._第4张图片
重启数据库
Cannot connect to the database. –Error connecting to database._第5张图片
问题三、 Error connecting to database.
Cannot connect to the database. –Error connecting to database._第6张图片
解决办法 :

#su - postgres      #进入数据库
$ cat logfile       #查看数据库日志
ERROR:  relation "users" does not exist at character 20
STATEMENT:  select userid from users limit 1
ERROR:  relation "users" does not exist at character 20
STATEMENT:  select userid from users limit 1
ERROR:  relation "users" does not exist at character 20
STATEMENT:  select userid from users limit 1

Cannot connect to the database. –Error connecting to database._第7张图片
数据库报错信息: ERROR: relation “users” does not exist at character 20

zabbix日志报错信息 :

 38468:20200130:195744.484 using configuration file: /etc/zabbix/zabbix_server.conf
 38468:20200130:195744.491 [Z3005] query failed: [0] PGRES_FATAL_ERROR:ERROR:  relation "users" does not exist
LINE 1: select userid from users limit 1
                           ^
 [select userid from users limit 1]
 38468:20200130:195744.491 cannot use database "zabbix": database is not a Zabbix database

Cannot connect to the database. –Error connecting to database._第8张图片
解决办法 :
删除数据库,重新创建。

postgres=# drop database zabbix;
DROP DATABASE
postgres=# drop user zabbix;
DROP ROLE
postgres@ubuntu:~$  createuser --pwprompt zabbix
Enter password for new role: 
Enter it again: 
postgres@ubuntu:~$ createdb -O zabbix zabbix
postgres@ubuntu:~$


你可能感兴趣的:(监控,运维,Ubuntu)