Обсуждение: Problem of installation on Mac
Hi, I am a newbie for pgsql and tried to install it on my MacBookPro Intel. I got everything correct until creating the user: postgres and initdb, then the error message showed up for running the db. How to fix the problem?
LizheXusComputer:/Users/lizhexu pgsql$ /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &
[1] 17837
LizheXusComputer:/Users/lizhexu pgsql$ su: logfile: Permission denied
[1]+ Exit 1 /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1
LizheXusComputer:/Users/lizhexu pgsql$ su lizhexu
Password:
LizheXusComputer:~ lizhexu$ /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &
[1] 17842
LizheXusComputer:~ lizhexu$ /usr/local/pgsql/bin/createdb test
createdb: could not connect to database postgres: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
[1]+ Exit 2 /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1
Thank you very much.
L
I just install it as my own user on my laptop... I usually do something like
./configure --prefix=/Users/myaccount/pgsql
make && make install
then
cd ~/
pgsql/bin/initdb -D /Users/myaccount/pgsql/data
pgsql/bin/pg_ctl _D /Users/myaccount/pgsql/data start
and I'm off to the races ;-)
Good luck!
On 10/18/07, Lizhe.Xu@aphis.usda.gov <Lizhe.Xu@aphis.usda.gov> wrote:
Hi, I am a newbie for pgsql and tried to install it on my MacBookPro Intel. I got everything correct until creating the user: postgres and initdb, then the error message showed up for running the db. How to fix the problem?
LizheXusComputer:/Users/lizhexu pgsql$ /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &
[1] 17837
LizheXusComputer:/Users/lizhexu pgsql$ su: logfile: Permission denied
[1]+ Exit 1 /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1
LizheXusComputer:/Users/lizhexu pgsql$ su lizhexu
Password:
LizheXusComputer:~ lizhexu$ /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &
[1] 17842
LizheXusComputer:~ lizhexu$ /usr/local/pgsql/bin/createdb test
createdb: could not connect to database postgres: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
[1]+ Exit 2 /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1
Thank you very much.
L
Lizhe.Xu@aphis.usda.gov wrote: > Hi, I am a newbie for pgsql and tried to install it on my MacBookPro > Intel. I got everything correct until creating the user: postgres and > initdb, then the error message showed up for running the db. How to fix > the problem? > > LizheXusComputer:/Users/lizhexu pgsql$ /usr/local/pgsql/bin/postgres -D > /usr/local/pgsql/data >logfile 2>&1 & > [1] 17837 > LizheXusComputer:/Users/lizhexu pgsql$ su: logfile: Permission denied > > [1]+ Exit 1 /usr/local/pgsql/bin/postgres -D > /usr/local/pgsql/data >logfile 2>&1 > LizheXusComputer:/Users/lizhexu pgsql$ su lizhexu > Password: > LizheXusComputer:~ lizhexu$ /usr/local/pgsql/bin/postgres -D > /usr/local/pgsql/data >logfile 2>&1 & > [1] 17842 > LizheXusComputer:~ lizhexu$ /usr/local/pgsql/bin/createdb test > createdb: could not connect to database postgres: could not connect to > server: No such file or directory > Is the server running locally and accepting > connections on Unix domain socket "/tmp/.s.PGSQL.5432"? > [1]+ Exit 2 /usr/local/pgsql/bin/postgres -D > /usr/local/pgsql/data >logfile 2>&1 > > > Thank you very much. > > > L > > I would say the problem is when you are logged in as pgsql the >logfile part tries to put the log file in the current working directory (/Users/lizhexu in your example). Your pgsql user doesn't have permission to write the log file there. When you are logged in as lizhexu you don't get permission to read the data files. Also it should be >>logfile changing >logfile to >>/usr/local/pgsql/data/logfile will most likely fix the problem. I would suggest looking into contrib/start-scripts (from the source distro) - look at PostgreSQL.darwin - the comments at the top should get you started. These steps will have postgres running when you startup your Mac. You will need to change PGUSER="postgres" to PGUSER="pgsql", leave the rest and try running it. hint - with startup scripts if you don't want to restart you can use - sudo /Library/StartupItems/PostgreSQL/PostgreSQL start Also which version are you installing and did you get a binary package somewhere or are you building from source? -- Shane Ambler pgSQL@Sheeky.Biz Get Sheeky @ http://Sheeky.Biz
Thank you very much Shane. It fixed my problem, at least now :-).
I installed the pgsql 8.2.5 from source. The user "postgres" has a shortname of "pgsql".
Another question, what's the purpose/advantage to create a user of postgres? May I just create the database under my user account?
Shane Ambler <pgsql@Sheeky.Biz> 10/18/2007 01:27 PM |
|
Lizhe.Xu@aphis.usda.gov wrote:
> Hi, I am a newbie for pgsql and tried to install it on my MacBookPro
> Intel. I got everything correct until creating the user: postgres and
> initdb, then the error message showed up for running the db. How to fix
> the problem?
>
> LizheXusComputer:/Users/lizhexu pgsql$ /usr/local/pgsql/bin/postgres -D
> /usr/local/pgsql/data >logfile 2>&1 &
> [1] 17837
> LizheXusComputer:/Users/lizhexu pgsql$ su: logfile: Permission denied
>
> [1]+ Exit 1 /usr/local/pgsql/bin/postgres -D
> /usr/local/pgsql/data >logfile 2>&1
> LizheXusComputer:/Users/lizhexu pgsql$ su lizhexu
> Password:
> LizheXusComputer:~ lizhexu$ /usr/local/pgsql/bin/postgres -D
> /usr/local/pgsql/data >logfile 2>&1 &
> [1] 17842
> LizheXusComputer:~ lizhexu$ /usr/local/pgsql/bin/createdb test
> createdb: could not connect to database postgres: could not connect to
> server: No such file or directory
> Is the server running locally and accepting
> connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
> [1]+ Exit 2 /usr/local/pgsql/bin/postgres -D
> /usr/local/pgsql/data >logfile 2>&1
>
>
> Thank you very much.
>
>
> L
>
>
I would say the problem is when you are logged in as pgsql the >logfile
part tries to put the log file in the current working directory
(/Users/lizhexu in your example). Your pgsql user doesn't have
permission to write the log file there. When you are logged in as
lizhexu you don't get permission to read the data files. Also it should
be >>logfile changing >logfile to >>/usr/local/pgsql/data/logfile will
most likely fix the problem.
I would suggest looking into contrib/start-scripts (from the source
distro) - look at PostgreSQL.darwin - the comments at the top should get
you started. These steps will have postgres running when you startup
your Mac.
You will need to change PGUSER="postgres" to PGUSER="pgsql", leave the
rest and try running it.
hint - with startup scripts if you don't want to restart you can use -
sudo /Library/StartupItems/PostgreSQL/PostgreSQL start
Also which version are you installing and did you get a binary package
somewhere or are you building from source?
--
Shane Ambler
pgSQL@Sheeky.Biz
Get Sheeky @ http://Sheeky.Biz
Lizhe.Xu@aphis.usda.gov wrote: > Thank you very much Shane. It fixed my problem, at least now :-). > > I installed the pgsql 8.2.5 from source. The user "postgres" has a > shortname of "pgsql". > > Another question, what's the purpose/advantage to create a user of > postgres? May I just create the database under my user account? > Technically you can run postgresql (and most other services) as almost any user - the reason you don't is security - being run as pgsql it can only read and write to files that that user account has access to. You would normally only allow it to write in the data directory setup for it. If it is hacked into it can only overwrite files in that one directory not your entire system. If it only needs limited access to the filesystem to run then don't give it access to everything. This also works the other way - if the pgsql user is the only one with read access to the data files then other users have trouble getting a copy of them. If you run ps aux (or activity monitor) you will see a few different user names listed for different services. > > Shane Ambler <pgsql@Sheeky.Biz> > 10/18/2007 01:27 PM > > To > Lizhe.Xu@aphis.usda.gov > cc > pgsql-general@postgresql.org > Subject > Re: [GENERAL] Problem of installation on Mac > > > > > > > Lizhe.Xu@aphis.usda.gov wrote: >> Hi, I am a newbie for pgsql and tried to install it on my MacBookPro >> Intel. I got everything correct until creating the user: postgres and >> initdb, then the error message showed up for running the db. How to fix >> the problem? >> >> LizheXusComputer:/Users/lizhexu pgsql$ /usr/local/pgsql/bin/postgres -D >> /usr/local/pgsql/data >logfile 2>&1 & >> [1] 17837 >> LizheXusComputer:/Users/lizhexu pgsql$ su: logfile: Permission denied >> >> [1]+ Exit 1 /usr/local/pgsql/bin/postgres -D >> /usr/local/pgsql/data >logfile 2>&1 >> LizheXusComputer:/Users/lizhexu pgsql$ su lizhexu >> Password: >> LizheXusComputer:~ lizhexu$ /usr/local/pgsql/bin/postgres -D >> /usr/local/pgsql/data >logfile 2>&1 & >> [1] 17842 >> LizheXusComputer:~ lizhexu$ /usr/local/pgsql/bin/createdb test >> createdb: could not connect to database postgres: could not connect to >> server: No such file or directory >> Is the server running locally and accepting >> connections on Unix domain socket "/tmp/.s.PGSQL.5432"? >> [1]+ Exit 2 /usr/local/pgsql/bin/postgres -D >> /usr/local/pgsql/data >logfile 2>&1 >> >> >> Thank you very much. >> >> >> L >> >> > > I would say the problem is when you are logged in as pgsql the >logfile > part tries to put the log file in the current working directory > (/Users/lizhexu in your example). Your pgsql user doesn't have > permission to write the log file there. When you are logged in as > lizhexu you don't get permission to read the data files. Also it should > be >>logfile changing >logfile to >>/usr/local/pgsql/data/logfile will > most likely fix the problem. > > I would suggest looking into contrib/start-scripts (from the source > distro) - look at PostgreSQL.darwin - the comments at the top should get > you started. These steps will have postgres running when you startup > your Mac. > > You will need to change PGUSER="postgres" to PGUSER="pgsql", leave the > rest and try running it. > > hint - with startup scripts if you don't want to restart you can use - > sudo /Library/StartupItems/PostgreSQL/PostgreSQL start > > > > Also which version are you installing and did you get a binary package > somewhere or are you building from source? > > > -- Shane Ambler pgSQL@Sheeky.Biz Get Sheeky @ http://Sheeky.Biz
If I understand correctly, the user "pgsql", besides having its own file system not related to others, is the administrator of the postgresql db administrator. Only "pgsql" can modify the db, but the other users can query the db but not modify it. Am I rigth? What I should do, if other users need to update the db. Thank you very much.
Shane Ambler <pgsql@Sheeky.Biz> 10/19/2007 12:08 PM |
|
Lizhe.Xu@aphis.usda.gov wrote:
> Thank you very much Shane. It fixed my problem, at least now :-).
>
> I installed the pgsql 8.2.5 from source. The user "postgres" has a
> shortname of "pgsql".
>
> Another question, what's the purpose/advantage to create a user of
> postgres? May I just create the database under my user account?
>
Technically you can run postgresql (and most other services) as almost
any user - the reason you don't is security - being run as pgsql it can
only read and write to files that that user account has access to. You
would normally only allow it to write in the data directory setup for
it. If it is hacked into it can only overwrite files in that one
directory not your entire system. If it only needs limited access to the
filesystem to run then don't give it access to everything.
This also works the other way - if the pgsql user is the only one with
read access to the data files then other users have trouble getting a
copy of them.
If you run ps aux (or activity monitor) you will see a few different
user names listed for different services.
>
> Shane Ambler <pgsql@Sheeky.Biz>
> 10/18/2007 01:27 PM
>
> To
> Lizhe.Xu@aphis.usda.gov
> cc
> pgsql-general@postgresql.org
> Subject
> Re: [GENERAL] Problem of installation on Mac
>
>
>
>
>
>
> Lizhe.Xu@aphis.usda.gov wrote:
>> Hi, I am a newbie for pgsql and tried to install it on my MacBookPro
>> Intel. I got everything correct until creating the user: postgres and
>> initdb, then the error message showed up for running the db. How to fix
>> the problem?
>>
>> LizheXusComputer:/Users/lizhexu pgsql$ /usr/local/pgsql/bin/postgres -D
>> /usr/local/pgsql/data >logfile 2>&1 &
>> [1] 17837
>> LizheXusComputer:/Users/lizhexu pgsql$ su: logfile: Permission denied
>>
>> [1]+ Exit 1 /usr/local/pgsql/bin/postgres -D
>> /usr/local/pgsql/data >logfile 2>&1
>> LizheXusComputer:/Users/lizhexu pgsql$ su lizhexu
>> Password:
>> LizheXusComputer:~ lizhexu$ /usr/local/pgsql/bin/postgres -D
>> /usr/local/pgsql/data >logfile 2>&1 &
>> [1] 17842
>> LizheXusComputer:~ lizhexu$ /usr/local/pgsql/bin/createdb test
>> createdb: could not connect to database postgres: could not connect to
>> server: No such file or directory
>> Is the server running locally and accepting
>> connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
>> [1]+ Exit 2 /usr/local/pgsql/bin/postgres -D
>> /usr/local/pgsql/data >logfile 2>&1
>>
>>
>> Thank you very much.
>>
>>
>> L
>>
>>
>
> I would say the problem is when you are logged in as pgsql the >logfile
> part tries to put the log file in the current working directory
> (/Users/lizhexu in your example). Your pgsql user doesn't have
> permission to write the log file there. When you are logged in as
> lizhexu you don't get permission to read the data files. Also it should
> be >>logfile changing >logfile to >>/usr/local/pgsql/data/logfile will
> most likely fix the problem.
>
> I would suggest looking into contrib/start-scripts (from the source
> distro) - look at PostgreSQL.darwin - the comments at the top should get
> you started. These steps will have postgres running when you startup
> your Mac.
>
> You will need to change PGUSER="postgres" to PGUSER="pgsql", leave the
> rest and try running it.
>
> hint - with startup scripts if you don't want to restart you can use -
> sudo /Library/StartupItems/PostgreSQL/PostgreSQL start
>
>
>
> Also which version are you installing and did you get a binary package
> somewhere or are you building from source?
>
>
>
--
Shane Ambler
pgSQL@Sheeky.Biz
Get Sheeky @ http://Sheeky.Biz
assume the tablename you want to determine privs and access is called 'TABLENAME'
SELECT priv, access_lvl FROM TABLENAME WHERE user = 'pgsql'
M--
M--
----- Original Message -----From: Lizhe.Xu@aphis.usda.govTo: Shane AmblerSent: Friday, October 19, 2007 12:19 PMSubject: Re: [GENERAL] Problem of installation on Mac
If I understand correctly, the user "pgsql", besides having its own file system not related to others, is the administrator of the postgresql db administrator. Only "pgsql" can modify the db, but the other users can query the db but not modify it. Am I rigth? What I should do, if other users need to update the db. Thank you very much.
Shane Ambler <pgsql@Sheeky.Biz> 10/19/2007 12:08 PM
ToLizhe.Xu@aphis.usda.gov ccpgsql-general@postgresql.org SubjectRe: [GENERAL] Problem of installation on Mac
Lizhe.Xu@aphis.usda.gov wrote:
> Thank you very much Shane. It fixed my problem, at least now :-).
>
> I installed the pgsql 8.2.5 from source. The user "postgres" has a
> shortname of "pgsql".
>
> Another question, what's the purpose/advantage to create a user of
> postgres? May I just create the database under my user account?
>
Technically you can run postgresql (and most other services) as almost
any user - the reason you don't is security - being run as pgsql it can
only read and write to files that that user account has access to. You
would normally only allow it to write in the data directory setup for
it. If it is hacked into it can only overwrite files in that one
directory not your entire system. If it only needs limited access to the
filesystem to run then don't give it access to everything.
This also works the other way - if the pgsql user is the only one with
read access to the data files then other users have trouble getting a
copy of them.
If you run ps aux (or activity monitor) you will see a few different
user names listed for different services.
>
> Shane Ambler <pgsql@Sheeky.Biz>
> 10/18/2007 01:27 PM
>
> To
> Lizhe.Xu@aphis.usda.gov
> cc
> pgsql-general@postgresql.org
> Subject
> Re: [GENERAL] Problem of installation on Mac
>
>
>
>
>
>
> Lizhe.Xu@aphis.usda.gov wrote:
>> Hi, I am a newbie for pgsql and tried to install it on my MacBookPro
>> Intel. I got everything correct until creating the user: postgres and
>> initdb, then the error message showed up for running the db. How to fix
>> the problem?
>>
>> LizheXusComputer:/Users/lizhexu pgsql$ /usr/local/pgsql/bin/postgres -D
>> /usr/local/pgsql/data >logfile 2>&1 &
>> [1] 17837
>> LizheXusComputer:/Users/lizhexu pgsql$ su: logfile: Permission denied
>>
>> [1]+ Exit 1 /usr/local/pgsql/bin/postgres -D
>> /usr/local/pgsql/data >logfile 2>&1
>> LizheXusComputer:/Users/lizhexu pgsql$ su lizhexu
>> Password:
>> LizheXusComputer:~ lizhexu$ /usr/local/pgsql/bin/postgres -D
>> /usr/local/pgsql/data >logfile 2>&1 &
>> [1] 17842
>> LizheXusComputer:~ lizhexu$ /usr/local/pgsql/bin/createdb test
>> createdb: could not connect to database postgres: could not connect to
>> server: No such file or directory
>> Is the server running locally and accepting
>> connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
>> [1]+ Exit 2 /usr/local/pgsql/bin/postgres -D
>> /usr/local/pgsql/data >logfile 2>&1
>>
>>
>> Thank you very much.
>>
>>
>> L
>>
>>
>
> I would say the problem is when you are logged in as pgsql the >logfile
> part tries to put the log file in the current working directory
> (/Users/lizhexu in your example). Your pgsql user doesn't have
> permission to write the log file there. When you are logged in as
> lizhexu you don't get permission to read the data files. Also it should
> be >>logfile changing >logfile to >>/usr/local/pgsql/data/logfile will
> most likely fix the problem.
>
> I would suggest looking into contrib/start-scripts (from the source
> distro) - look at PostgreSQL.darwin - the comments at the top should get
> you started. These steps will have postgres running when you startup
> your Mac.
>
> You will need to change PGUSER="postgres" to PGUSER="pgsql", leave the
> rest and try running it.
>
> hint - with startup scripts if you don't want to restart you can use -
> sudo /Library/StartupItems/PostgreSQL/PostgreSQL start
>
>
>
> Also which version are you installing and did you get a binary package
> somewhere or are you building from source?
>
>
>
--
Shane Ambler
pgSQL@Sheeky.Biz
Get Sheeky @ http://Sheeky.Biz
On Oct 20, 2000, at 13:05 , Martin Gainty wrote: Martin, it continues to amaze me how you're able to predict and contribute to the discussion 7 years in advance! Michael Glaesemann grzm seespotcode net
Michael Glaesemann wrote: > > On Oct 20, 2000, at 13:05 , Martin Gainty wrote: > > Martin, it continues to amaze me how you're able to predict and > contribute to the discussion 7 years in advance! > > Michael Glaesemann > grzm seespotcode net > But temporal causality is preserved, as we only get to see his posts now (for forward-incrementing instances of "now"). (or something like that) brian
On Oct 19, 2007, at 13:50 , brian wrote: > Michael Glaesemann wrote: >> On Oct 20, 2000, at 13:05 , Martin Gainty wrote: >> Martin, it continues to amaze me how you're able to predict and >> contribute to the discussion 7 years in advance! >> Michael Glaesemann >> grzm seespotcode net > > But temporal causality is preserved, as we only get to see his > posts now (for forward-incrementing instances of "now"). > > (or something like that) Nah. Occam's razor: network lag :) Michael Glaesemann grzm seespotcode net
On 10/19/07, Michael Glaesemann <grzm@seespotcode.net> wrote: > > On Oct 19, 2007, at 13:50 , brian wrote: > > > Michael Glaesemann wrote: > >> On Oct 20, 2000, at 13:05 , Martin Gainty wrote: > >> Martin, it continues to amaze me how you're able to predict and > >> contribute to the discussion 7 years in advance! > >> Michael Glaesemann > >> grzm seespotcode net > > > > But temporal causality is preserved, as we only get to see his > > posts now (for forward-incrementing instances of "now"). > > > > (or something like that) > > Nah. Occam's razor: network lag :) Still connecting with a half-duplex ARCnet card are we?
Michael Glaesemann wrote: > > On Oct 19, 2007, at 13:50 , brian wrote: > >> Michael Glaesemann wrote: >> >>> On Oct 20, 2000, at 13:05 , Martin Gainty wrote: >>> Martin, it continues to amaze me how you're able to predict and >>> contribute to the discussion 7 years in advance! >>> Michael Glaesemann >>> grzm seespotcode net >> >> >> But temporal causality is preserved, as we only get to see his posts >> now (for forward-incrementing instances of "now"). >> >> (or something like that) > > > Nah. Occam's razor: network lag :) > "forward-incrementing" -- Ach, such redundancy! Oh, well, too late now. Or is it?
Lizhe.Xu@aphis.usda.gov wrote: > If I understand correctly, the user "pgsql", besides having its own file > system not related to others, is the administrator of the postgresql db > administrator. Only "pgsql" can modify the db, but the other users can > query the db but not modify it. Am I rigth? What I should do, if other > users need to update the db. Thank you very much. > I might just clarify this a little as some find it confusing - you have two user accounts with the name pgsql, one is a system user account the other is a postgresql database user. The two account names are completely separate and don't need to have the same names. The postgresql server (the program itself running on your machine) is run using the system pgsql account allowing the server to have access to your file system based on the privileges setup on for your system user account. The pgsql database user account is used to determine who can connect to the postgresql server through a client application (whether run remotely or from the same machine) and what data held within the postgresql server they can access. You can create other database users and specify what they can access and what tasks they can perform. So you would keep pgsql as the admin user with unlimited access to all db's and then create a user1 account and then say that user1 can connect to mydb1 and can select, insert and update data in mydb1. You can then create user2 and say they can connect to mydb1 and can only perform selects on mydb1. Within postgresql these user accounts are referred to as roles - see the manual on CREATE ROLE for more info. http://www.postgresql.org/docs/8.2/interactive/sql-createrole.html -- Shane Ambler pgSQL@Sheeky.Biz Get Sheeky @ http://Sheeky.Biz