# Sessions configuration for postgresql

**URL:** <https://community.grafana.com/t/sessions-configuration-for-postgresql/678>\
**Category:** PostgreSQL\
**Tags:** postgres\
**Created:** [April 26, 2017, 3:52am UTC](https://community.grafana.com/t/sessions-configuration-for-postgresql/678 "2017-04-26T03:52:31Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuva](https://avatars.discourse-cdn.com/v4/letter/y/4af34b/32.png) [@yuva](https://community.grafana.com/u/yuva)\
**Post date:** [April 26, 2017, 3:52am UTC](https://community.grafana.com/t/sessions-configuration-for-postgresql/678/1 "2017-04-26T03:52:31Z")

</div>

Hi,

I am using postgres and enable session and configure the postgres username and password, then i restart the service. But the service got failed. From the log i could not find much information. I m using postgres94 version.

FYI:-  
t=2017-04-26T11:48:52+0800 lvl=info msg=“Starting Grafana” logger=main version=4.2.0 commit=349f3eb compiled=2017-03-22T18:06:41+0800  
t=2017-04-26T11:48:52+0800 lvl=info msg=“Config loaded from” logger=settings file=/usr/share/grafana/conf/defaults.ini  
t=2017-04-26T11:48:52+0800 lvl=info msg=“Config loaded from” logger=settings file=/etc/grafana/grafana.ini  
t=2017-04-26T11:48:52+0800 lvl=info msg=“Config overriden from command line” logger=settings arg=“default.paths.data=/var/lib/grafana”  
t=2017-04-26T11:48:52+0800 lvl=info msg=“Config overriden from command line” logger=settings arg=“default.paths.logs=/var/log/grafana”  
t=2017-04-26T11:48:52+0800 lvl=info msg=“Config overriden from command line” logger=settings arg=“default.paths.plugins=/var/lib/grafana/plugins”  
t=2017-04-26T11:48:52+0800 lvl=info msg=“Path Home” logger=settings path=/usr/share/grafana  
t=2017-04-26T11:48:52+0800 lvl=info msg=“Path Data” logger=settings path=/var/lib/grafana  
t=2017-04-26T11:48:52+0800 lvl=info msg=“Path Logs” logger=settings path=/var/log/grafana  
t=2017-04-26T11:48:52+0800 lvl=info msg=“Path Plugins” logger=settings path=/var/lib/grafana/plugins  
t=2017-04-26T11:48:52+0800 lvl=info msg=“Initializing DB” logger=sqlstore dbtype=postgres  
t=2017-04-26T11:48:52+0800 lvl=info msg=“Starting DB migration” logger=migrator  
t=2017-04-26T11:48:52+0800 lvl=info msg=“Executing migration” logger=migrator id=“copy data account to org”  
t=2017-04-26T11:48:52+0800 lvl=info msg=“Skipping migration condition not fulfilled” logger=migrator id=“copy data account to org”  
t=2017-04-26T11:48:52+0800 lvl=info msg=“Executing migration” logger=migrator id=“copy data account\_user to org\_user”  
t=2017-04-26T11:48:52+0800 lvl=info msg=“Skipping migration condition not fulfilled” logger=migrator id=“copy data account\_user to org\_user”  
t=2017-04-26T11:48:52+0800 lvl=info msg=“Ldap enabled, reading config file” logger=ldap file=/etc/grafana/ldap.toml  
t=2017-04-26T11:48:52+0800 lvl=info msg=“Starting plugin search” logger=plugins  
t=2017-04-26T11:48:52+0800 lvl=info msg=“Registering plugin” logger=plugins name=“Datatable Panel”  
t=2017-04-26T11:48:52+0800 lvl=info msg=“Registering plugin” logger=plugins name=“Pie Chart”  
t=2017-04-26T11:48:52+0800 lvl=info msg=“Registering plugin” logger=plugins name=Splunk  
t=2017-04-26T11:48:52+0800 lvl=info msg=“Registering plugin” logger=plugins name=Histogram  
t=2017-04-26T11:48:52+0800 lvl=info msg=“Initializing Alerting” logger=alerting.engine  
t=2017-04-26T11:48:52+0800 lvl=info msg=“Initializing CleanUpService” logger=cleanup

---

<div class="post-metadata">

**Author:** ![torkel](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/torkel/32/20_2.png) [@torkel](https://community.grafana.com/u/torkel)\
**Post date:** [April 26, 2017, 4:51am UTC](https://community.grafana.com/t/sessions-configuration-for-postgresql/678/2 "2017-04-26T04:51:55Z")

</div>

strange, no other reports on this failing.

Is your postgres connection details correct? Is Postgres up and running? If you wait a few minutes do you see anything else in log? (looks like it hanged)

---

<div class="post-metadata">

**Author:** ![yuva](https://avatars.discourse-cdn.com/v4/letter/y/4af34b/32.png) [@yuva](https://community.grafana.com/u/yuva)\
**Post date:** [April 26, 2017, 7:58am UTC](https://community.grafana.com/t/sessions-configuration-for-postgresql/678/3 "2017-04-26T07:58:01Z")

</div>

Nope. i could not see any thing in the log

yes postgres db is running. if i remove the session configuration, i can restart grafana. i am suspecting to look for configuration. My sesssion configuration in this format. is there any thing wrong in my configuration.

FYI:-

postgres: user=\*\*\*\* password=\*\*\*\*\* host=127.0.0.1 port=5432 dbname=\*\*\*\* sslmode=disable

---

<div class="post-metadata">

**Author:** ![torkel](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/torkel/32/20_2.png) [@torkel](https://community.grafana.com/u/torkel)\
**Post date:** [April 26, 2017, 12:32pm UTC](https://community.grafana.com/t/sessions-configuration-for-postgresql/678/4 "2017-04-26T12:32:48Z")

</div>

```auto
[session]
provider = postgres
provider_config = user=DBUSER password=XXXX host=DBHOST port=5432 dbname=grafana sslmode=disabled

```

important that dbname=grafana (or the name of your grafana database)

---

<div class="post-metadata">

**Author:** ![yuva](https://avatars.discourse-cdn.com/v4/letter/y/4af34b/32.png) [@yuva](https://community.grafana.com/u/yuva)\
**Post date:** [April 27, 2017, 6:17am UTC](https://community.grafana.com/t/sessions-configuration-for-postgresql/678/5 "2017-04-27T06:17:27Z")

</div>

> [@torkel](#):
>
> [session]  
> provider = postgres  
> provider\_config = user=DBUSER password=XXXX host=DBHOST port=5432 dbname=grafana sslmode=disabled

Yes DB is correct. But whenever i restart the grafana service. i found this error in postgresql log.

FYI:-  
\< 2017-04-27 14:15:55.168 +08 \>ERROR: relation “INFORMATION\_SCHEMA.TABLES” does not exist at character 26  
\< 2017-04-27 14:15:55.168 +08 \>STATEMENT: SELECT “TABLE\_NAME” from “INFORMATION\_SCHEMA”.“TABLES” WHERE “TABLE\_SCHEMA”=$1 and “TABLE\_NAME”=$2  
\< 2017-04-27 14:15:55.172 +08 \>ERROR: relation “INFORMATION\_SCHEMA.TABLES” does not exist at character 26  
\< 2017-04-27 14:15:55.172 +08 \>STATEMENT: SELECT “TABLE\_NAME” from “INFORMATION\_SCHEMA”.“TABLES” WHERE “TABLE\_SCHEMA”=$1 and “TABLE\_NAME”=$2  
\< 2017-04-27 14:15:55.251 +08 \>LOG: incomplete startup packet

---

<div class="post-metadata">

**Author:** ![torkel](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/torkel/32/20_2.png) [@torkel](https://community.grafana.com/u/torkel)\
**Post date:** [April 27, 2017, 6:34am UTC](https://community.grafana.com/t/sessions-configuration-for-postgresql/678/6 "2017-04-27T06:34:34Z")

</div>

that is strange, something wrong with your grafana db? Try removing the grafana db and recreate it, Grafana should recreate the schema

---

<div class="post-metadata">

**Author:** ![yuva](https://avatars.discourse-cdn.com/v4/letter/y/4af34b/32.png) [@yuva](https://community.grafana.com/u/yuva)\
**Post date:** [April 27, 2017, 8:01am UTC](https://community.grafana.com/t/sessions-configuration-for-postgresql/678/7 "2017-04-27T08:01:09Z")

</div>

Even i m facing the same issues in new database as well.

---

<div class="post-metadata">

**Author:** ![torkel](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/torkel/32/20_2.png) [@torkel](https://community.grafana.com/u/torkel)\
**Post date:** [April 27, 2017, 9:46am UTC](https://community.grafana.com/t/sessions-configuration-for-postgresql/678/8 "2017-04-27T09:46:17Z")

</div>

what version of postgres are you using?

---

<div class="post-metadata">

**Author:** ![yuva](https://avatars.discourse-cdn.com/v4/letter/y/4af34b/32.png) [@yuva](https://community.grafana.com/u/yuva)\
**Post date:** [April 27, 2017, 10:28am UTC](https://community.grafana.com/t/sessions-configuration-for-postgresql/678/9 "2017-04-27T10:28:49Z")

</div>

I m using postgresql9.4

---

<div class="post-metadata">

**Author:** ![alexraddas](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@alexraddas](https://community.grafana.com/u/alexraddas)\
**Post date:** [May 2, 2018, 4:13pm UTC](https://community.grafana.com/t/sessions-configuration-for-postgresql/678/10 "2018-05-02T16:13:09Z")

</div>

I had this issue when I wrapped the username and password in quotes. I removed the quotes and everything worked as it should.

---

<div class="post-metadata">

**Author:** ![robertmoon](https://avatars.discourse-cdn.com/v4/letter/r/ac8455/32.png) [@robertmoon](https://community.grafana.com/u/robertmoon)\
**Post date:** [August 10, 2018, 4:25pm UTC](https://community.grafana.com/t/sessions-configuration-for-postgresql/678/11 "2018-08-10T16:25:45Z")

</div>

I have just run in to a similar issue where i could not connect to the database. I solved the issue by wrapping the whole config in “”“triple quotes”"" to treat it as literal and Grafana was able to start.
