Does postgresql by default have a database named `postgres`?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












From http://suite.opengeo.org/docs/latest/dataadmin/pgGettingStarted/firstconnect.html, it says:




Run the psql command from the postgres user account:



sudo -u postgres psql postgres



Does the first postgres mean that psql will be run by user postgres?



What does the second postgres mean?



The manpage of psql gives



SYNOPSIS
psql [option...] [dbname [username]]


Is the second postgres a dbname?



Does postgresql by default have a database named postgres, as well as a user named postgres?



Thanks.







share|improve this question




















  • Yes... and yes... and yes... Try this command: sudo -u postgres psql -c "l"
    – RubberStamp
    Dec 6 '17 at 22:28














up vote
0
down vote

favorite












From http://suite.opengeo.org/docs/latest/dataadmin/pgGettingStarted/firstconnect.html, it says:




Run the psql command from the postgres user account:



sudo -u postgres psql postgres



Does the first postgres mean that psql will be run by user postgres?



What does the second postgres mean?



The manpage of psql gives



SYNOPSIS
psql [option...] [dbname [username]]


Is the second postgres a dbname?



Does postgresql by default have a database named postgres, as well as a user named postgres?



Thanks.







share|improve this question




















  • Yes... and yes... and yes... Try this command: sudo -u postgres psql -c "l"
    – RubberStamp
    Dec 6 '17 at 22:28












up vote
0
down vote

favorite









up vote
0
down vote

favorite











From http://suite.opengeo.org/docs/latest/dataadmin/pgGettingStarted/firstconnect.html, it says:




Run the psql command from the postgres user account:



sudo -u postgres psql postgres



Does the first postgres mean that psql will be run by user postgres?



What does the second postgres mean?



The manpage of psql gives



SYNOPSIS
psql [option...] [dbname [username]]


Is the second postgres a dbname?



Does postgresql by default have a database named postgres, as well as a user named postgres?



Thanks.







share|improve this question












From http://suite.opengeo.org/docs/latest/dataadmin/pgGettingStarted/firstconnect.html, it says:




Run the psql command from the postgres user account:



sudo -u postgres psql postgres



Does the first postgres mean that psql will be run by user postgres?



What does the second postgres mean?



The manpage of psql gives



SYNOPSIS
psql [option...] [dbname [username]]


Is the second postgres a dbname?



Does postgresql by default have a database named postgres, as well as a user named postgres?



Thanks.









share|improve this question











share|improve this question




share|improve this question










asked Dec 6 '17 at 22:23









Ethan

1032




1032











  • Yes... and yes... and yes... Try this command: sudo -u postgres psql -c "l"
    – RubberStamp
    Dec 6 '17 at 22:28
















  • Yes... and yes... and yes... Try this command: sudo -u postgres psql -c "l"
    – RubberStamp
    Dec 6 '17 at 22:28















Yes... and yes... and yes... Try this command: sudo -u postgres psql -c "l"
– RubberStamp
Dec 6 '17 at 22:28




Yes... and yes... and yes... Try this command: sudo -u postgres psql -c "l"
– RubberStamp
Dec 6 '17 at 22:28










1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










From sudo documentation:



-u user, --user=user
Run the command as a user other than the default target user (usually root).


From (PostgreSQL) initdb documentation:




Creating a database cluster consists of creating the directories in which the database data will live, generating the shared catalog tables (tables that belong to the whole cluster rather than to any particular database), and creating the template1 and postgres databases.




and




-U username --username=username



Selects the user name of the database superuser. This defaults to the name of the effective user running initdb. It is really not important what the superuser's name is, but one might choose to keep the customary name postgres, even if the operating system user's name is different.




From psql documentation you quote you can see that, besides options, you call it with either a database name, or a database name and user name



If you do not provide a database name it tries to connect to the database name being the name of the user currently running psql, as explained in documentation:




The default user name is your operating-system user name, as is the default database name.







share|improve this answer






















  • Thanks. Can you point out where it says " if you do not provide a database name it tries to connect to the database name being the name of the user currently running psql"?
    – Ethan
    Dec 7 '17 at 0:54










  • I have edited the end of my answer to add the relevant line from psql manual
    – Patrick Mevzek
    Dec 7 '17 at 1:23










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f409332%2fdoes-postgresql-by-default-have-a-database-named-postgres%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote



accepted










From sudo documentation:



-u user, --user=user
Run the command as a user other than the default target user (usually root).


From (PostgreSQL) initdb documentation:




Creating a database cluster consists of creating the directories in which the database data will live, generating the shared catalog tables (tables that belong to the whole cluster rather than to any particular database), and creating the template1 and postgres databases.




and




-U username --username=username



Selects the user name of the database superuser. This defaults to the name of the effective user running initdb. It is really not important what the superuser's name is, but one might choose to keep the customary name postgres, even if the operating system user's name is different.




From psql documentation you quote you can see that, besides options, you call it with either a database name, or a database name and user name



If you do not provide a database name it tries to connect to the database name being the name of the user currently running psql, as explained in documentation:




The default user name is your operating-system user name, as is the default database name.







share|improve this answer






















  • Thanks. Can you point out where it says " if you do not provide a database name it tries to connect to the database name being the name of the user currently running psql"?
    – Ethan
    Dec 7 '17 at 0:54










  • I have edited the end of my answer to add the relevant line from psql manual
    – Patrick Mevzek
    Dec 7 '17 at 1:23














up vote
1
down vote



accepted










From sudo documentation:



-u user, --user=user
Run the command as a user other than the default target user (usually root).


From (PostgreSQL) initdb documentation:




Creating a database cluster consists of creating the directories in which the database data will live, generating the shared catalog tables (tables that belong to the whole cluster rather than to any particular database), and creating the template1 and postgres databases.




and




-U username --username=username



Selects the user name of the database superuser. This defaults to the name of the effective user running initdb. It is really not important what the superuser's name is, but one might choose to keep the customary name postgres, even if the operating system user's name is different.




From psql documentation you quote you can see that, besides options, you call it with either a database name, or a database name and user name



If you do not provide a database name it tries to connect to the database name being the name of the user currently running psql, as explained in documentation:




The default user name is your operating-system user name, as is the default database name.







share|improve this answer






















  • Thanks. Can you point out where it says " if you do not provide a database name it tries to connect to the database name being the name of the user currently running psql"?
    – Ethan
    Dec 7 '17 at 0:54










  • I have edited the end of my answer to add the relevant line from psql manual
    – Patrick Mevzek
    Dec 7 '17 at 1:23












up vote
1
down vote



accepted







up vote
1
down vote



accepted






From sudo documentation:



-u user, --user=user
Run the command as a user other than the default target user (usually root).


From (PostgreSQL) initdb documentation:




Creating a database cluster consists of creating the directories in which the database data will live, generating the shared catalog tables (tables that belong to the whole cluster rather than to any particular database), and creating the template1 and postgres databases.




and




-U username --username=username



Selects the user name of the database superuser. This defaults to the name of the effective user running initdb. It is really not important what the superuser's name is, but one might choose to keep the customary name postgres, even if the operating system user's name is different.




From psql documentation you quote you can see that, besides options, you call it with either a database name, or a database name and user name



If you do not provide a database name it tries to connect to the database name being the name of the user currently running psql, as explained in documentation:




The default user name is your operating-system user name, as is the default database name.







share|improve this answer














From sudo documentation:



-u user, --user=user
Run the command as a user other than the default target user (usually root).


From (PostgreSQL) initdb documentation:




Creating a database cluster consists of creating the directories in which the database data will live, generating the shared catalog tables (tables that belong to the whole cluster rather than to any particular database), and creating the template1 and postgres databases.




and




-U username --username=username



Selects the user name of the database superuser. This defaults to the name of the effective user running initdb. It is really not important what the superuser's name is, but one might choose to keep the customary name postgres, even if the operating system user's name is different.




From psql documentation you quote you can see that, besides options, you call it with either a database name, or a database name and user name



If you do not provide a database name it tries to connect to the database name being the name of the user currently running psql, as explained in documentation:




The default user name is your operating-system user name, as is the default database name.








share|improve this answer














share|improve this answer



share|improve this answer








edited Dec 7 '17 at 1:23

























answered Dec 6 '17 at 22:46









Patrick Mevzek

2,0381721




2,0381721











  • Thanks. Can you point out where it says " if you do not provide a database name it tries to connect to the database name being the name of the user currently running psql"?
    – Ethan
    Dec 7 '17 at 0:54










  • I have edited the end of my answer to add the relevant line from psql manual
    – Patrick Mevzek
    Dec 7 '17 at 1:23
















  • Thanks. Can you point out where it says " if you do not provide a database name it tries to connect to the database name being the name of the user currently running psql"?
    – Ethan
    Dec 7 '17 at 0:54










  • I have edited the end of my answer to add the relevant line from psql manual
    – Patrick Mevzek
    Dec 7 '17 at 1:23















Thanks. Can you point out where it says " if you do not provide a database name it tries to connect to the database name being the name of the user currently running psql"?
– Ethan
Dec 7 '17 at 0:54




Thanks. Can you point out where it says " if you do not provide a database name it tries to connect to the database name being the name of the user currently running psql"?
– Ethan
Dec 7 '17 at 0:54












I have edited the end of my answer to add the relevant line from psql manual
– Patrick Mevzek
Dec 7 '17 at 1:23




I have edited the end of my answer to add the relevant line from psql manual
– Patrick Mevzek
Dec 7 '17 at 1:23

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f409332%2fdoes-postgresql-by-default-have-a-database-named-postgres%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay