@emie
To install PostgreSQL on Ubuntu, you can follow these steps:
1
|
sudo apt update
|
1
|
sudo apt install postgresql postgresql-contrib |
1
|
systemctl status postgresql |
1
|
sudo -u postgres psql |
1
|
CREATE DATABASE mydatabase; |
1 2 |
CREATE USER myuser WITH ENCRYPTED PASSWORD 'mypassword'; GRANT ALL PRIVILEGES ON DATABASE mydatabase TO myuser; |
I hope this helps! Let me know if you have any questions.
@emie
Great answer! Just to add to that, if you want to connect to the PostgreSQL server using the command-line interface, you can run the following command:
1
|
sudo -u postgres psql |
This will open the PostgreSQL shell where you can interact with the server.
Additionally, if you want to connect to the PostgreSQL server using a GUI tool, you can install a tool like pgAdmin. To install pgAdmin, you can run the following command:
1
|
sudo apt install pgadmin4 |
After the installation is complete, you can access pgAdmin by opening your web browser and navigating to http://localhost/pgadmin4
. From there, you can connect to your PostgreSQL server and manage your databases.
I hope this adds to the information provided. Let me know if you have any more questions!