In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
This article shows you the steps of linux installation and configuration of postgresql, the code is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
Install postgresql-related packages through yum
Sudo yum install-y postgresql postgresql-server postgresql96-devel postgresql-contrib postgresql-docs
Initialize the database
Sudo service postgresql initdb / / determine the version of postgresql based on the installed version eg: sudo service postgresql96 initdb
Start the database
Sudo service postgresql start
Create users and data
/ / first log in to postgres user sudo su postpres psql// and enter psql after entering the previous command, then you can enter the sql statement create user testuser with password 'testpwd';// to create a database create database testdb owner testuser; / / grant users the right to operate the database grant all privileges on database testdb to testuser \ Q exit / / modify the configuration file, and the setting data can access the sudo cd / var/lib/pgsql/data / / edit file sudo vim postgresql.conf remotely.
Modify a file
Listen_addresses = 'localhost' changed to listen_addresses =' *'
Modify the file pg_hba.conf
Add a line at the bottom of the file
Host all all 0.0.0.0/0 md5
/ / restart the service
Note: check to see if the permission of the data file is 700. if not, change it to 700 sudo chmod 700 / var/bin/data/
Sudo service restart postgresql
Test connection
Psql-h *. *-d testdb-U testuser
Errors that may be encountered
Peer authentication failed for user "postgres"
Solution method
Sudo vim / var/lib/pgsql/data/pg_hba.conf
Change host all all peer to
Host all all trust
If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.