By now, you would have realized the goal of this discussion. It aims to guide you on the connection mechanism of a PostgreSQL database while using the Windows 10 command prompt. Note: You can also play around with the PostgreSQL databases while using the SQL Shell or psql however, the goal of this article was different from this. How to connect to the PostgreSQL Database through Windows 10 Command Line Interface (CLI)?įor connecting to any desired PostgreSQL database through Windows 10 CLI, you will have to perform the following five steps, whereas the sixth one is optional. However, we would like to state over here that you should first read all of these steps thoroughly and then start performing them so that you can accomplish the desired task correctly without making any mistakes. Step # 1: Set up the Environment Variable of your Windows 10 System:īefore starting to use the Windows 10 command prompt for accessing the PostgreSQL environment, you need to set up your system’s environment variable. Otherwise, you will face issues while accessing the PostgreSQL environment on your system. For setting up the required environment variable, you have to type “env” in your Windows 10 search bar and click on the “Edit the system environment variables” result.Īfter choosing this option, the System Properties window will pop up on your screen. You need to click on the third tab named the “Advanced” tab within this window. In that tab, you need to locate the Environment Variables button and click on it. Then, go to the System variables section and double click on the Path option located over there. This will let you add the Path of your PostgreSQL server’s bin directory to the PATH environment variable so that the PostgreSQL environment can be accessed easily from the Windows 10 command prompt.įrom the PATH environment variable, you need to click on the “New” button so that you can add a new path to it. Here, you need to copy and paste the path of your PostgreSQL server’s bin directory at the specified location. After adding this path, you can proceed further by clicking on the “OK” button. Step # 2: Access the Command Prompt through your Windows 10 System: After that, you can also close the System Properties window. Once you have correctly set up the required environment variable for your PostgreSQL server, the next step is to launch the command prompt on Windows 10. For that, you have to use the Windows 10 search bar again and look for “cmd” in it. You will instantly be able to see the Command Prompt result on which you need to click for launching it. The default Command Prompt window of our Windows 10 system is shown below. Initially, no commands will be executed, but you will see how you can run commands within Windows 10 command prompt in the following step. Step # 3: Enter the PostgreSQL Environment through the Command Prompt: For that, you need to run the command shown below: Now, you need to access the PostgreSQL environment through Windows 10 command prompt. Here, “postgres” represents the default username for the PostgreSQL server. During the installation of the PostgreSQL server, and even after that, you can create a new user. However, since we did not create any new user for our PostgreSQL server, we will have to access the PostgreSQL environment through the user-created by default during the installation. If you have also not created a new user, then your default username will also be “postgres”. When you run the above-mentioned command, you will be asked to provide your specified user account password. For the default user account, you are requested to create a password for accessing it during the PostgreSQL server’s installation therefore, in this case, we will be providing that password that we had set up for the default user account during the installation of the PostgreSQL server on our Windows 10 system. Soon after providing the correct password for the specified user account, you will immediately enter the PostgreSQL environment while staying within Windows 10 command prompt. #Postgresql psequel for windows windows 10
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |