On Windows 10, search for pgAdmin and click on it to open it. It is GUI based tool that allows you to interact with PostgreSQL servers and databases. The pgAdmin tool is installed as a part of PostgreSQL installation. Thus, you can connect to the PostgreSQL database using SQL Shell. It will connect you to postgres database as 'postgres' superuser. It will prompt for the password, where you need to enter a password. Psql -h localhost -p 5432 -d postgres -U postgres (you may enter this path to your environment variable) Open a command prompt and navigate to your local C:\Program Files\PostgreSQL\14\bin and enter the following command. SQL Shell can be opened from the command prompt. So, this is how you can connect to your PostgreSQL database with SQL Shell (psql) and start working. To check what all databases are there, enter \l command in psql, as shown below. This will show the currently installed version of PostgreSQL. Now, let's validate the version of the database using SELECT version() command, as shown below. The default username is postgres and enter a password that you gave during installation.Īfter providing the correct username and password, you will be connected to the postgres database, as shown below. Next, provide username and password to connect with the database. Press Enter to continue with the default port. This was the port you gave at the time of installation. Next, enter the port number on your server to connect. If you want to connect to another existing database then enter that name and press Enter. Press Enter to connect with the default database named postgres. Next, it will ask for the Database to connect to the server. The default value mentioned in the square bracket e.g. if it is on your localhost then press Enter. First, you need to enter the PostgreSQL server name.
0 Comments
Leave a Reply. |