I'm running PostgreSQL on mt Windows 7 machine. To run a database I type:
C:\psql -Upostgres mydb
and this works, but it would be nice if I could leave off the -U
stuff, but then Postgres thinks I'm trying to log in as 'Eric', since that is my user profile.
So I need to add a user to Postgres, obviously. But how? If I try:
C:\createuser Eric
Postgres thinks I'm trying to add a user Eric as the user Eric which fails. Adding the -U
flag doesn't seem to work here.
What am I missing? My command window is in administrator mode, and there is no sudo
available, obviously.
To add a user, click the Add (+) button at the top right corner. Provide information about the new pgAdmin role in the row: Use the drop-down list box next to Authentication source field to select the type of authentication that should be used for the user.
In pgadmin you can create a new "Login Role" and name it Eric and give it permissions graphically, or from command line you can do something like this
psql -U postgres -c "CREATE ROLE Eric LOGIN NOSUPERUSER INHERIT CREATEDB CREATEROLE;" mydb
see http://developer.postgresql.org/pgdocs/postgres/sql-createrole.html for information on the CREATE ROLE options.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With