PostgreSQL under Lion: What's the password? - macos

I got my new lion machine. Ran the PostgreSQL installer from the PostgreSQL site for Mac and i have no multiple apps installed. One of them is "pgAdmin III.app". When I open it there is already one server connection available. localhost:5432
Whenever I try to connect to the server with a doubleclick the programm asks me for a password. I have no idea what to enter. It's not my admin password, it's not "postgres", it's not "localhost", it's not empty.
I just can't seem to connect to the server. Even when I check the properties of the localhost server the password field seems empty. However I'm not allowed to leave the password field empty.
Any idea what to do? I really need to setup postgres?

On my Mac OSX Lion, PostgreSQL configuration files are stored under /Library/PostgreSQL/9.0/data/

Haven't tried it on OSX, but on Ubuntu you can login as the system user 'postgres' to the default database 'postgres' without a password with
su postgres -c psql
You can then (re)set the password of the database superuser 'postgres'.
You can also edit the configuration file pg_hba.conf (don't know where it is located on a default OSX installation, on Ubuntu it is /etc/postgresql/8.4/main/pg_hba.conf) and grant access to the default database without authentication
# TYPE DATABASE USER CIDR-ADDRESS METHOD
host postgres postgres 127.0.0.1/32 trust
After editing pg_hba.conf you must reload the configuration with
pg_ctlcluster 8.4 main reload
You can then connect with pgAdmin and (re)set the password, but don't forget to change the authentication method back to md5 again...

here's a better answer (works in OSX HighSierra): the account used is the one you're logged onto OSX with, therefore, the password is your password!

A similar question has been asked a short time ago. The steps described there should be appropriate for Lion also.
Postgresql: password authentication failed for user "postgres"

Related

How to log in to odoo after creating a database?

The requirements for odoo 9 are successfully installed. I'm vaulting the software from the source directory without installing it using the command
./openerp-server -r <USER> -w <PASSWORD> --db_port 5432 -d <DATABASE>
When I first ran the command as postgres user, the browser at the address localhost:8069 asked me to create a new database with a database name (although I already gave DATABASE as mydb in the command line above) using an admin user password. I gave odootest as database name along with the admin password (postgres user password) and checked the load demonstration data checkbox. The new instance was created and the list of apps were displayed. Everything was fine till that point
After logging out, I'm unable to log back in as the screen now shows this
I don't remember giving any email id with a password for this. How am I supposed to log in now? Is there any default entry for this?
OS: Mac OS-X 10.9
You can use in every OS
user: admin
psw: admin
it's default for all odoo/openerp version

What is the default password for Postgres

I have just install Postgres 9.3 on Windows 7. The installation completed successfully. It has never asked me to provide the password for postgres user.
The service postgresql-x64-9.3 is up and running. However, I cannot connect: I do not not know the password. I've found the following answer, but it did not help:
similar question on Ubuntu
[LINUX]
might work for windows too
After installing postgres follow following steps in order to setup password for default system account of Linux execute following in terminal:
user:~$ sudo -i -u postgres
postgres#user:~$ psql
after executing above two commands you will get into postgres shell
Execute this query in postgres shell:
postgres=# ALTER USER postgres PASSWORD 'mynewpassword';
your new password is 'mynewpassword' without quotes and now you can connect with external GUI tools like DBeaver
WARNING: trust means exactly that. Anyone who can connect to the PostgreSQL server can control it. If you set trust mode that allows superusers like user postgres (or all users) to connect, they get total control of your PostgreSQL and can probably run shell commands too. You should usually only use it to change the password then restore the configuration back to the auth mode you were using before.
If you used an unattended installer script, the password will be in the script or associated config file.
Otherwise, treat it the same as if you lost/forgot the password rather than never knowing it:
Edit pg_hba.conf, setting the auth mode to trust instead of the default md5
In the Services control panel restart the PostgreSQL service
Connect with psql or PgAdmin or whatever
ALTER USER postgres PASSWORD 'mynewpassword';
Edit pg_hba.conf again and set the auth mode back to md5
Restart PostgreSQL again
pg_hba.conf is in your data directory. By default it'll be %PROGRAMFILES%\PostgreSQL\9.3\data.
To edit it you'll have to use the security tab to give yourself read/write permissions (via a UAC prompt). This might require you to set yourself as the owner of the file.
On unix systems it's more secure to prepend a
local all all peer
line to pg_hba.conf and then sudo -u postgres psql (assuming your PostgreSQL server runs as user postgres) to get an interactive psql session without using a password. That way you don't have to use trust.
On initialisation you can access the DB as:
Username: postgres
Password: postgres
By default user postgres does not have a password
Start psql and create a password:
sudo -u postgres psql
\password postgres - It will ask you enter a password for user postgres
Through trial and error I found that the password for Postgre SQL 10 for the username postgres is "admin". I kept typing in different password until I reached that password. I am using pgAdmin 4 to test out my SQL Statements, POSTGRE SQL 10 is the first server connection set up using localhost.
It seems there was no default password, but psql wouldn't accept a lack of a password (fe_sendauth: no password supplied). To get around this, I opened pgAdmin, then in the left sidebar:
Servers
Login/Group Roles
Right click postgres and click Properties,
Go to Definition tab
Set the password in the Password field
After saving, psql accepted that password. There may have been a switch I could have supplied to have it accept a lack of a password (--no-password?), but the user should probably have a password anyways, so this seemed reasonable.
go to control >> computer management >> Locaol users and group >> users >>
right click on openpgsvc >> set password.
after that now you can access with this password on openpgsvc
The simplest solution I've found is just to install PgAdmin and connect to the local server with the current Windows credentials (username + password). Then you can change the password to the postgres user.
step1: Go to control panel
Step2: Click on Administrative Tools
Step3: Click on Computer Management
Step4: There under "Local Users and Groups" Double click on user
Step:5: then right click on postgres and you can set password
refer this below image

PostgreSQL 9.2.4 - Desire to Change the Localhost Server Password in Mavericks & Databases

Currently PostgreSQL 9.2.4 is provided in OSX Mavericks. I have used the provided PostgreSQL since running Lion Server. When I started using it I was using a password that I now realize is not very secure.
I am having trouble finding the right command to do this. The user/role (I supposed) that is provided is _postgres. This is the password I would like to change. I attempted the command below but honestly I'm not sure what it is supposed to do. I thought that this would allow me to access the role/user.
psql -U _postgres -h localhost -W
Here is what happened when I attempted to execute this command.
xxxx:~ xxxx$ psql -U _postgres -h localhost -W
Password for user _postgres:
psql: FATAL: database "_postgres" does not exist
_postgres is the user for all my databases. I would like to change the password for _postgres. I'm not sure since the databases were created by _postgres that once I change that password if the password will work for the databases or if I will have to change the database passwords also.
All the solutions dealing with this reference directories that I do not have in Mavericks. When I used Lion and Mountain Lion I was able to go to the psql directory and find postgresql.conf and pg_hba.conf. I do a search on those files and do not find them.
Sidebar: I currently use PgAdmin3 for basic database maintenance. The Mac version of the software does not have an option for changing passwords that I can find. If there is another GUI software package that is more user friendly for accessing the provided PostgreSQL I would definitely like to try it. Every solution that suggests Homebrew is in the context of installing another version of PostgreSQL which is not what I want to do.
I need the correct terminal command(s) to do this or help on where to go to get the solution that will work with OS X Mavericks. The PostgreSQL documentation is a bit overwhelming and was not clear as to where to go and what to do regarding this.
Any help would be appreciated.
UPDATE 4/5 6:03 pm CDT
Here are the contents in /Library/Server/PostgreSQL/Data/pg_hba.conf
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication _postgres trust
#host replication _postgres 127.0.0.1/32 trust
#host replication _postgres ::1/128 trust

Forgotten password for Postgresql - Resetting password - Mac OS X Leopard

I used blog entry by Robby on Rails site:
http://www.robbyonrails.com/articles/2008/01/22/installing-ruby-on-rails-and-postgresql-on-os-x-third-edition
Got to the end, but when I tried accessing the pg database I was denied.
I've tried to change pg_hba.config file to trust so that I can gain access anyway (without a password), but proved fruitless.
Please help. Thanks in advance.
Restart postgresql after you alter the pg_hba.config file to make sure your changes are read. Next, type
psql -U myUser template1
in a terminal, where myUseris the name of the user running the postgres proces. That should make you log in as administrator. Next, in the psql session, write
ALTER USER realUser PASSWORD 'myNewPassword';
in order to reset the password. Here realUseris the user of the database you are trying to connect to.

How to login to Postgres after install on Mac Snow Leopard?

I got Postgres 8.4 installed on my mac with Snow Leopard. I know the 'postgres' user was created but I have no idea what the default password is. How should I login to the database?
http://archives.postgresql.org/pgsql-admin/2001-10/msg00192.php and similar internet resources may answer your question. Supposedly, there is no password by default.
For future readers...
I had a similar problem. After installing Postgres 9.1, the password I supplied to the installer didn't allow me to connect to the database using pgadmin 3. This is what I had to do to fix it:
Configure so you can log in without a password:
Stop the postgres server (launch daemon):
sudo launchctl unload /Library/LaunchDaemons/com.edb.launchd.postgresql-9.1.plist
Edit data/pg_hba.conf and change 'md5' to 'trust' in the 'local'
'127.0.0.1/32' line.
Start the daemon
sudo launchctl load /Library/LaunchDaemons/com.edb.launchd.postgresql-9.1.plist
Connect using pgadmin 3 and re-set the password
Start pgadmin 3 and connect to the database (right click 'Connect' on the Postgres 9.1 server).
Under Login roles, right-click the 'posgres' user, select 'Properties...' and reset the password on the 'Definition' tab panel.
Then disconnect pgadmin 3 from the database (right-click 'Disconnect' on the Postgres 9.1 server).
Configure the server so it requires a password again:
Stop the daemon (as per step 1.1).
Edit data/pg_hba.conf and change 'trust' back to 'md5' in the
'local' '127.0.0.1/32' line.
Start the daemon (as per step 1.3).

Resources