In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "ubuntu installation postgresql and usage introduction". In daily operation, I believe many people have doubts about ubuntu installation postgresql and usage introduction. Xiaobian consulted all kinds of information and sorted out simple and easy to use operation methods. I hope to help you answer the doubts of "ubuntu installation postgresql and usage introduction"! Next, please follow the small series to learn together!
mounting assembly
client installation
sudo apt-get install postgresql-client
server installation
The code is as follows:
sudo apt-get install postgresql postgresql-contrib
Get a list of plugins for Installing PostGIS, procedural languages, client interfaces, etc.
The code is as follows:
apt-cache search postgres
Ruby PG gem installation, need to generate Native Extension
First install the appropriate package.
The code is as follows:
sudo apt-get install libpq-dev
Find pg_config
The code is as follows:
sudo find / -name pg_config
Install pg gem
The code is as follows:
gem install pg -- --with-pg-config=/usr/bin/pg_config
server configuration
Set up postgres user, log in with postgres user and change password
The code is as follows:
sudo -u postgres psql postgres
Set password for postgres user
The code is as follows:
\password postgres
create a new database
The code is as follows:
sudo -u postgres createdb mydb
Server Advanced Settings
create user
The code is as follows:
sudo -u postgres createuser --superuser $USER
sudo -u postgres psql
postgres=# \password $USER
Manage users and permissions
Edit the file/etc/postgresql/current/main/postgresql.conf to listen on other networks
The code is as follows:
listen_addresses = '*'
Create a new user tesdb and the database testdb owned by that user
The code is as follows:
sudo -u postgres createuser -D -A -P testdb
sudo -u postgres createdb -O testdb testdb
Edit the/etc/postgresql/current/main/pg_hba.conf file to allow testdb users to connect remotely to the testdb database
The code is as follows:
host testdb testdb 0.0.0.0/0 md5
reload the configuration
The code is as follows:
sudo /etc/init.d/postgresql reload
restart the database
The code is as follows:
sudo /etc/init.d/postgresql restart
At this point, the study of "ubuntu installation postgresql and usage introduction" is over, hoping to solve everyone's doubts. Theory and practice can better match to help you learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!
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
© 2024 shulou.com SLNews company. All rights reserved.