Page 1 of 3

PostgreSQL on Mac unable to login to database

PostPosted: Sat Oct 27, 2012 2:28 pm
by joaoleao
Hi

I just had my Macbook Pro hard drive replaced. I had a Time Machine backup and just migrated all the data to the new disk.
When I opened PT3 for the first time, a small window with the title "Configure PostgreSQL Database" popped up. In this window I clicked "Browse Databases" and got an error message saying "Unable to login to database(template1). Reason: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.sPGSQL.5432?""

I'm aware of another thread (https://www.pokertracker.com/forums/vie ... 17&t=42906) where this was suggested:
sudo su postgres -c '/Library/PostgreSQL/9.0/bin/pg_ctl -D /Library/PostgreSQL/9.0/data/ restart'

It didn't work for me (as my version of is 8.4 and I appropriately replaced "9.0" for "8.4" in that string). Terminal spitted a somewhat complicated output.

Should I re-install or install a newer version of PostgreSQL? Will I lose previous data when I do this?

Thanks in advance.
Joao

Re: PostgreSQL on Mac unable to login to database

PostPosted: Sat Oct 27, 2012 2:45 pm
by kraada
Please paste the output the terminal gave you - that will help determine what is going on here.

Re: PostgreSQL on Mac unable to login to database

PostPosted: Sat Oct 27, 2012 2:53 pm
by joaoleao
kraada wrote:Please paste the output the terminal gave you - that will help determine what is going on here.


Here it is:

pg_ctl: PID file "/Library/PostgreSQL/8.4/data/postmaster.pid" does not exist
Is server running?
starting server anyway
server starting
Apples-MacBook-Pro:~ joao$ 2012-10-27 19:50:52 WESTFATAL: could not create shared memory segment: Invalid argument
2012-10-27 19:50:52 WESTDETAIL: Failed system call was shmget(key=5432001, size=36872192, 03600).
2012-10-27 19:50:52 WESTHINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded your kernel's SHMMAX parameter. You can either reduce the request size or reconfigure the kernel with larger SHMMAX. To reduce the request size (currently 36872192 bytes), reduce PostgreSQL's shared_buffers parameter (currently 4096) and/or its max_connections parameter (currently 103).
If the request size is already small, it's possible that it is less than your kernel's SHMMIN parameter, in which case raising the request size or reconfiguring SHMMIN is called for.
The PostgreSQL documentation contains more information about shared memory configuration.

Re: PostgreSQL on Mac unable to login to database

PostPosted: Sat Oct 27, 2012 3:07 pm
by kraada
Run this at the terminal and paste the output here for me:

cat /etc/sysctl.conf

Re: PostgreSQL on Mac unable to login to database

PostPosted: Sat Oct 27, 2012 3:21 pm
by joaoleao
kraada wrote:Run this at the terminal and paste the output here for me:

cat /etc/sysctl.conf


cat: /etc/sysctl.conf: No such file or directory

Re: PostgreSQL on Mac unable to login to database

PostPosted: Sat Oct 27, 2012 5:09 pm
by kraada
Ok, at the terminal type:

sudo nano /etc/sysctl.conf

It will bring up a text editor. Type in:

kern.sysv.shmmax=67108864
kern.sysv.shmmin=1
kern.sysv.shmmni=256
kern.sysv.shmseg=64
kern.sysv.shmall=16384

Press ctrl+o and enter to save the file, then ctrl+x to exit. Then restart your computer and PostgreSQL should work properly.

Re: PostgreSQL on Mac unable to login to database

PostPosted: Sun Oct 28, 2012 12:24 pm
by joaoleao
It's working now.
Thanks kraada :)

Re: PostgreSQL on Mac unable to login to database

PostPosted: Fri Oct 11, 2013 6:51 pm
by clartann
I get the same error

I tried the solution above, but my settings are the same as below. I'm not sure what to do to get it to work

Re: PostgreSQL on Mac unable to login to database

PostPosted: Sat Oct 12, 2013 5:04 am
by WhiteRider
Can you tell us what you did before this error started, or did you never have this working?
Do you have PostgreSQL installed on your computer?

Re: PostgreSQL on Mac unable to login to database

PostPosted: Tue Oct 15, 2013 7:21 pm
by clartann
postgresql was installed automatically. I've never had PT working

highfalutin