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 --interactiveThis 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 do I use PostgreSQL's XMLTABLE to parse XML data?
- How can I retrieve data from PostgreSQL for yesterday's date?
- How do I use PostgreSQL's XMIN and XMAX features?
- How do I use the PostgreSQL quote_ident function?
- How do I round a number in PostgreSQL?
- How do I use the PostgreSQL NVL function?
- How do I use PostgreSQL with Qt?
- How can I use PostgreSQL XOR to compare two values?
- How do I use the WITH statement in PostgreSQL?
- How can I decide between PostgreSQL and MySQL for my software development project?
See more codes...