postgresqlHow do I install PostgreSQL on Ubuntu?
-
Download and install the PostgreSQL package:
sudo apt-get install postgresql postgresql-contrib
-
Create a new PostgreSQL user:
sudo -u postgres createuser --interactive
This command will prompt you to create a new user. Type in the name of the user you want to create.
-
Create a new database:
sudo -u postgres createdb [database name]
-
Connect to the database:
psql -U [username] -d [database name]
-
Set a password for the user:
\password [username]
-
Grant privileges to the user:
GRANT ALL PRIVILEGES ON DATABASE [database name] TO [username];
-
Exit the PostgreSQL shell:
\q
Helpful links
More of Postgresql
- How can I integrate PostgreSQL with Yii2?
- How can I extract the year from a PostgreSQL timestamp?
- How can I use PostgreSQL XOR to compare two values?
- How can Zalando use PostgreSQL to improve its software development?
- How can I use PostgreSQL and ZFS snapshots together?
- How can I troubleshoot zero damaged pages in PostgreSQL?
- How do I use PostgreSQL ZonedDateTime to store date and time information?
- How can I set a PostgreSQL interval to zero?
- How can I monitor PostgreSQL performance using Zabbix?
- How can I use PostgreSQL with YAML?
See more codes...