Re: Creating a PostgreSQL db
On Thu, Mar 10, 2016 at 01:26:40AM +0530, Suvayu Ali wrote: > Hi Gordon, > > On Wed, Mar 09, 2016 at 10:50:03AM -0800, Gordon Messmer wrote: > > On 03/09/2016 10:18 AM, Suvayu Ali wrote: > > >Shouldn't the local line take care of my permissions? What am I doing > > >wrong? > > > > The only user that exists by default is "postgres". Use that use to create > > new users and databases: > > > > su postgres -c "createuser x" > > I still get an error, but a different one. > > $ createdb gurgaon_routing > createdb: database creation failed: ERROR: permission denied to create > database > > The logs say the exact same thing, what is going wrong? Okay, this worked: # su - postgres $ psql -c 'ALTER USER user CREATEDB' ALTER ROLE I guess I understand it, just wish this was clear in the docs. I found the answer here: http://www.postgresql.org/message-id/463b31d5.8040...@archonet.com Even the official tutorial says things like: If you installed PostgreSQL yourself then you should log in for the purposes of this tutorial under the user account that you started the server as. instead of the above advice! Cheers, -- Suvayu Open source is the future. It sets us free. -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org
Re: Creating a PostgreSQL db
On Wed, Mar 09, 2016 at 12:59:49PM -0600, Michael Cronenworth wrote: > On 03/09/2016 12:18 PM, Suvayu Ali wrote: > >I want to create a PostgreSQL db. So I did the following: > > > > $ su - > > # su - postgres > > $ pg_ctl initdb -D /var/lib/pgsql/data > > For future reference there is a helper script that can do this stuff for you. > > # postgresql-setup --init-db > > And when you need to upgrade the database format due to a PostgreSQL upgrade: > > # postgresql-setup --upgrade Thanks, hopefully I'll remember the next time. Cheers, -- Suvayu Open source is the future. It sets us free. -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org
Re: Creating a PostgreSQL db
Hi Gordon, On Wed, Mar 09, 2016 at 10:50:03AM -0800, Gordon Messmer wrote: > On 03/09/2016 10:18 AM, Suvayu Ali wrote: > >Shouldn't the local line take care of my permissions? What am I doing wrong? > > The only user that exists by default is "postgres". Use that use to create > new users and databases: > > su postgres -c "createuser x" I still get an error, but a different one. $ createdb gurgaon_routing createdb: database creation failed: ERROR: permission denied to create database The logs say the exact same thing, what is going wrong? Thanks, -- Suvayu Open source is the future. It sets us free. -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org
Re: Creating a PostgreSQL db
2016-03-09 19:59 GMT+01:00 Michael Cronenworth: > On 03/09/2016 12:18 PM, Suvayu Ali wrote: > >> I want to create a PostgreSQL db. So I did the following: >> >>$ su - >># su - postgres >>$ pg_ctl initdb -D /var/lib/pgsql/data >> > > For future reference there is a helper script that can do this stuff for > you. > > # postgresql-setup --init-db > > I would pass --data-checksums to initdb to checksum the data pages and report eventual corruption. -- john -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org
Re: Creating a PostgreSQL db
On 03/09/2016 12:18 PM, Suvayu Ali wrote: I want to create a PostgreSQL db. So I did the following: $ su - # su - postgres $ pg_ctl initdb -D /var/lib/pgsql/data For future reference there is a helper script that can do this stuff for you. # postgresql-setup --init-db And when you need to upgrade the database format due to a PostgreSQL upgrade: # postgresql-setup --upgrade -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org
Re: Creating a PostgreSQL db
On 03/09/2016 10:18 AM, Suvayu Ali wrote: Shouldn't the local line take care of my permissions? What am I doing wrong? The only user that exists by default is "postgres". Use that use to create new users and databases: su postgres -c "createuser x" -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org
Creating a PostgreSQL db
Hi, I want to create a PostgreSQL db. So I did the following: $ su - # su - postgres $ pg_ctl initdb -D /var/lib/pgsql/data $ exit # systemctl start postgresql # exit $ createdb mydb createdb: could not connect to database template1: FATAL: role "user" does not exist I don't understand this since /var/lib/pgsql/data/pg_hba.conf has these lines: # TYPE DATABASEUSERADDRESS METHOD local all all trust hostall all 127.0.0.1/32trust hostall all ::1/128 trust Shouldn't the local line take care of my permissions? What am I doing wrong? TIA, -- Suvayu Open source is the future. It sets us free. -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org