In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "how to recover administrator when you forget your password or do not have permission to log into the database in PostgreSQL". In daily operation, it is believed that many people have doubts about how to recover administrator when they forget their password or do not have permission to log on to the database in PostgreSQL. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the question of "how to recover administrator when you forget your password or do not have permission to log on to the database in PostgreSQL"! Next, please follow the editor to study!
Create the database and set the administrator to NOLOGIN
[pg12@localhost ~] $initdb-D / data/pg12/tmpdbThe files belonging to this database system will be owned by user "pg12" .This user must also own the server process.The database cluster will be initialized with locale "en_US.UTF-8" default database encoding has accordingly been set to "UTF8" default text search configuration will be set to "english" .data page checksums are disabled.creating directory / data/pg12/tmpdb. Okcreating subdirectories... Okselecting dynamic shared memory implementation... Posixselecting default max_connections... 100selecting default shared_buffers... 128MBselecting default timezone... PRCcreating configuration files... Okrunning bootstrap script... Okperforming post-bootstrap initialization... Oksyncing data to disk... Okinitdb: warning: enabling "trust" authentication for local connectionsYou can change this by editing pg_hba.conf or using the option-A, or--auth-local and-- auth-host, the next time you run initdb.Success. You can now start the database server using: pg_ctl-D / data/pg12/tmpdb-l logfile start [pg12@localhost ~] $pg_ctl-D / data/pg12/tmpdb-l logfile startwaiting for server to start.... Doneserver started [pg12@localhost ~] $psql-U pg12-c "ALTER ROLE pg12 WITH NOLOGIN"-d postgresALTER ROLE
An attempt was made to log in to the database, indicating that the login could not be made
[pg12@localhost ~] $psql-d postgrespsql: error: could not connect to server: FATAL: role "pg12" is not permitted to log in
Such "accidents" can be dealt with through single user mode.
Shut down the database
[pg12@localhost] $pg_ctl-D / data/pg12/tmpdb-l logfile stopwaiting for server to shut down.... Doneserver stopped
Start the database in single user mode mode
[pg12@localhost ~] $postgres-- single-D / data/pg12/tmpdb postgresPostgreSQL stand-alone backend 12beta1backend >
Perform maintenance tasks
Backend > alter role pg12 with loginbackend >
Start the database, log in
[pg12@localhost] $pg_ctl-D / data/pg12/tmpdb-l logfile startwaiting for server to start.... Doneserver started [pg12@localhost] $psql-U pg12-d postgrespsql (12beta1) Type "help" for help.postgres=# here, the study of "how to recover administrator when you forget your password or do not have permission to log in to the database in PostgreSQL" is over. I hope you can solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
Table A.2 data node configuration parameters
© 2024 shulou.com SLNews company. All rights reserved.