简体   繁体   中英

How to create a postgresql superuser without a superuser account?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM