Thread: Problems logging in
Important stuff: Fedora Core 2, postgresql-7.4.7-3.FC2.1 Also, I know *nothing* about PostGreSQL, SQL, or databases in general :-) I installed the RPMs and the service starts and runs. I added a user and gave it a password, and gave the psql user "postgres" a different password. But I can log on with neither. No, I didn't forget the passwords :-) Searching for this sort of problem leads to a lot of the same thing, and a lot of different responses about how the pg_hba.conf should read. I've tried a huge number of variations, restarting the service between each iteration. Normally, stuff like this is less painful with logs. But I can find no working log file for psql. In /etc/init.d/postgresql, I found a line PGLOG=/dev/null amd replaced it with PGLOG=/var/log/psqllog /var/log/psqllog was created but is 0 length after restarting the service and a few failed login attempts. Assuming there's no "This is the exact reason why your logins don't work" answer, how do I get logging working so as to at least have another clue? -- *********************************************************************** * John Oliver http://www.john-oliver.net/ * * * ***********************************************************************
> I installed the RPMs and the service starts and runs. I added a user > and gave it a password, and gave the psql user "postgres" a different > password. But I can log on with neither. No, I didn't forget the > passwords :-) when you first start postgres you need to specify the database you are connecting to. when you connect you could use template1 as it is reinstalled with postgresql: psql -U postgres -d template1 However, it would be safer (especially for new db users) to first create a testing database with the shell command createdb. createdb mydb Of course, for all of this to work your pg_hba.conf file must be working order. > Searching for this sort of problem leads to a lot of the same thing, and > a lot of different responses about how the pg_hba.conf should read. > I've tried a huge number of variations, restarting the service between > each iteration. you can reference the following page for ideas: http://www.postgresql.org/docs/7.4/interactive/client-authentication.html#EXAMPLE-PG-HBA.CONF but to get started I would recommend: " TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD local all all trust " > Normally, stuff like this is less painful with logs. But I can find no > working log file for psql. In /etc/init.d/postgresql, I found a line > PGLOG=/dev/null amd replaced it with PGLOG=/var/log/psqllog > /var/log/psqllog was created but is 0 length after restarting the > service and a few failed login attempts. Assuming there's no "This is > the exact reason why your logins don't work" answer, how do I get > logging working so as to at least have another clue? Let preface the next portion of my reply with the fact that I am not positive what I am says is true for Version 7 of postgresql. unless you specify otherwise, your log file will be located in your data directory. the first one is postgresql.log. The other log files are located in ../data/pg_log/ One point to be aware of, the type of messages that appear in the depends upon the setting of you postgresql.conf file. I hope some of this helps. Regards, Richard Broersma Jr.
On Sat, Apr 22, 2006 at 06:18:18PM -0700, Richard Broersma Jr wrote: > > you can reference the following page for ideas: > http://www.postgresql.org/docs/7.4/interactive/client-authentication.html#EXAMPLE-PG-HBA.CONF > > but to get started I would recommend: > " > TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD > local all all trust > > " Is whitespace important? Tabs? The number of spaces? Is: local all all trust The same as: local all all trust > Let preface the next portion of my reply with the fact that I am not positive what I am says is > true for Version 7 of postgresql. > > unless you specify otherwise, your log file will be located in your data directory. > the first one is postgresql.log. > The other log files are located in ../data/pg_log/ [root@web1 root]# ls /var/lib/pgsql/data/ base pg_clog pg_ident.conf pg_xlog postmaster.opts global pg_hba.conf PG_VERSION postgresql.conf postmaster.pid [root@web1 root]# ls -la /var/lib/pgsql/data/pg_xlog/ total 16412 drwx------ 2 postgres postgres 4096 Apr 12 17:34 . drwx------ 6 postgres postgres 4096 Apr 22 17:00 .. -rw------- 1 postgres postgres 16777216 Apr 22 17:00 0000000000000000 [root@web1 root]# file /var/lib/pgsql/data/pg_xlog/0000000000000000 /var/lib/pgsql/data/pg_xlog/0000000000000000: data > One point to be aware of, the type of messages that appear in the depends upon the setting of you > postgresql.conf file. Ohhhkaaaayyy... so, what settings would be needed to get usable logs? Set everything that has "log" in the name to "true"? -- *********************************************************************** * John Oliver http://www.john-oliver.net/ * * * ***********************************************************************
> Is whitespace important? Tabs? The number of spaces? > Ohhhkaaaayyy... so, what settings would be needed to get usable logs? > Set everything that has "log" in the name to "true"? --postgresql.conf redirect_stderr = true log_directory = 'pg_log' log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' log_rotation_size = 10240 log_min_messages = info log_line_prefix = '%t%%%d ' These are the setting in my conf file. Also, when start postgresql: This page is a good source for capturing postmaster messages http://www.postgresql.org/docs/7.4/interactive/postmaster-start.html pg_ctl start -D /usr/local/pgsql/data -l serverlog serverlog is the name and location of would you want postmaster logs. check your /ect/init.d/ script and /etc/conf.d/ conf for adding this functionality. Regards,
On Sat, Apr 22, 2006 at 07:51:19PM -0700, Richard Broersma Jr wrote: > > Is whitespace important? Tabs? The number of spaces? > > Ohhhkaaaayyy... so, what settings would be needed to get usable logs? > > Set everything that has "log" in the name to "true"? > > --postgresql.conf > > redirect_stderr = true > log_directory = 'pg_log' > log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' > log_rotation_size = 10240 > log_min_messages = info > log_line_prefix = '%t%%%d ' > > These are the setting in my conf file. [root@web1 root]# tail /var/log/pgsqllog FATAL: unrecognized configuration parameter "redirect_stderr" FATAL: unrecognized configuration parameter "log_directory" FATAL: unrecognized configuration parameter "log_filename" FATAL: unrecognized configuration parameter "log_rotation_size" FATAL: unrecognized configuration parameter "log_line_prefix" Looks like something else I tried got some form of logging working, but you must have a very different version of postgresql than I do :-) -- *********************************************************************** * John Oliver http://www.john-oliver.net/ * * * ***********************************************************************
> > redirect_stderr = true > > log_directory = 'pg_log' > > log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' > > log_rotation_size = 10240 > > log_min_messages = info > > log_line_prefix = '%t%%%d ' > > > > These are the setting in my conf file. > > [root@web1 root]# tail /var/log/pgsqllog > FATAL: unrecognized configuration parameter "redirect_stderr" > FATAL: unrecognized configuration parameter "log_directory" > FATAL: unrecognized configuration parameter "log_filename" > FATAL: unrecognized configuration parameter "log_rotation_size" > FATAL: unrecognized configuration parameter "log_line_prefix" > > Looks like something else I tried got some form of logging working, but > you must have a very different version of postgresql than I do :-) This is just a guess on my part, but I do not believe that PostgreSQL as rights to write logs to the /var/log directory. From my understanding PostgreSQL is a service that runs under the non-super-user postgres account.