How to create a postgresql superuser without a superuser account? - postgresql

OK...just installed Mountain Lion. First thing I noticed was that my Postgres user account was missing from the login screen. I then verified that my postgres installation was no longer working. So I created a new postgres user account on my Mac and set all the proper permission to get the postgres server to start. It started but immediately the server shutdown. I checked the log files and it said that role "postgres" does not exist.
I can't figure out how to create this user in the db since the db won't allow me to access it without using a superuser account. I tried "createuser postgres" but got the same message, "role 'postgres' does not exist". I don't know what to do at this point.

Found my problem. Somehow my postgres db user did get erased during the upgrade to mountain lion. I was able to log into the db using the same name that I use to log into the system however. Unfortunately, I found that my databases where also removed during the upgrade. I don't know why but the upgrade did effect my postgresql installation. After logging in, I found that the postgres db and the template1 db had no relations to be found. Now to piece my db back together...luckily I'm still in development mode. Note: In the future make db backups prior to upgrading system.

Related

PostgreSQL with DBeaver, password?

I am a student. I've created a Rails/React project using PostgreSQL. I downloaded DBeaver so that I can view my database but cannot get DBeaver to connect, and have spent a couple of hours trying to solve this.
I attempt to set up DBeaver for PostgreSQL, click "New Connection," leave all defaults set and click "Finish" when I'm met with the following error:
The server requested password-based authentication, but no password was provided.
I am pretty certain that I never entered a password for this database. I saw it suggested that the default password is "postgres" but I tried that with no success. In terminal when I run "psql --list" I can see my DB's name and I can see that I am the owner.
I am running a Debian distro, if that makes any difference. I installed DBrowser through Synaptic. I'd appreciate any assistance.

Creating new database object on DBeaver - ERROR: permission denied to create database

Probably basic stuff. I'm just trying out DBeaver for the first time to set up a Postgresql database.
I chose new database connection - Postgres
Host: localhost
Database: postgres
Username: postgres and system password ... All connected
but when I right click create new database or schema I get the error
"SQL Error [42501]: ERROR: permission denied to create database
ERROR: permission denied to create database"
Where could I be doing wrong?
User postgres don't have Create Database permission.
You can check list of given permissions from Roles->postgres
Note: By default Super User will have all the permissions but if your's is not Super User then you have to establish connection using Super User and then enable required permissions to Non Super User.
I am using Ubuntu OS. In my case was an issue when trying to save a DUMP on SSD. I solved by following steps:
1st - open ubuntu software
2nd - search for dbeaver-ce
3rd - after installed it, click Permissions
4th - check Read/write files on removable storage devices
Hope it might help someone in the future.
I tried to do the same over several hours yesterday. Apparently, DBeaver doesn't allow the creation of new databases (at least at this version of the software). You can connect to an existing DB and that's about it.

Remove all postgresql users/completely delete

As I attempt to create my initial user account on postgresql, I am prompted for my password, though when I enter the correct one I recieve:
createdb: could not connect to database template1: FATAL: password authentication failed for user "thomasmurphy"
I am installing through brew. My thought is that somewhere along the line I've set a password different from my system one. How do I remove all users so I can reset this pass.
I get my permission denied even if I su to postgres. I have gone through every thread on stackoverflow on this issue, and have tried:
*modifying my pg hba_conf
*updating my gems and developer tools
*running brew doctor
*reinstalling postgres
*all the other command line ideas through the thread
My situation seems to not have cropped up before, which convinces me I've set a password at some point that is now tripping all of my attempts. Adding to this theory is that I have a postgres setup on my work computer, also on mavericks, function perfectly.
Note that unless you changed defaults, homebrew installs Postgres with you as the superuser rather than as the postgres user. The issue might be that you're trying to use postgres "as normal" whereas it doesn't need or event want the usual postgres user references.
You see the list of users on the system using cat /etc/passwd, and you can change an arbitrary password by running chpass as root.

No postgresql user created after new Windows install

I'm trying to use postgresql with Rails so I can run locally before deploying to Heroku. I installed the latest version of postgresql (9.2.4) from enterprisedb.com.
When I try to double click the database in pgAdmin III, it asks for a postgresql password. There is no Windows postgresql account in the user settings. I did notice that during my subsequent uninstallation of the application, the uninstaller referenced a service user account "NetworkService."
If I try to run the command line psql command, it asks for a password, then it complains that authentication failed for (my windows login account name). I tried entering my usual Windows account password, and that didn't work.
What's going wrong here? I've read many posts of people running into password/account issues with this database.
There is no Windows postgresql account in the user settings.
The installer for 9.2 doesn't create a postgres Windows user account. People were having too many problems with the service account password, getting confused between the service account and the postgres database account, etc. It now installs and runs as NETWORKSERVICE by default.
You will have set a PostgreSQL database password when you installed. You must log in to PostgreSQL as the postgres user with the password you gave during installation.
With the help of bma, I was able to get my Rails application running on Windows by following these steps:
Install postgresql for Windows.
Open the pgAdmin III application from the Windows Start Menu.
Click on the File menu, click Open pg_hba.conf
Browse to C:\Program Files (x86)\PostgreSQL\9.2\data\pg_hba.conf.
Double click each of the rows and change md5 to trust

Problems with postgres database in redmine after change in password

First, I'm a total newbie and I guess that's why this error occurred in the first place.
A colleague of mine stopped working and so I had to take over administrative stuff as the redmine we use and making backups.
So I wanted to schedule these backups automatically. Somewhere on the way I changed /etc/postgresql/9.1/main/pg_hba.conf for user postgres (that's the one for the redmine database.
from local all postgress peer to local all postgress trust so I could run a shell program in crontab. This worked but then redmine doesn't work anymore. I get this:
FATAL: password authentication failed for user "postgres" FATAL:
password authentication failed for user "postgres" (PG::Error)
On this the error site for redmine. I changed everything back and restarted everything, but it did't work.
Then I used an older backup to restore but still.
So, now I have no idea whats wrong. Maybe someone can help me.
Thanks.
Barbara
I think it is because I've changed the password of the postgres user in ubuntu. I did not know at the moment that they are connected. I always got a password promt but I didn't know it (my colleague at least didn't tell me one) I've tried to change it in the data base as well with
ALTER USER Postgres WITH PASSWORD 'newpassword';
Would it be enough to reinstall the database and use an old backup?