This is the seventh day of my participation in the August More text Challenge. For details, see:August is more challenging
preface
Before because of learning, so the choice is a wide range of audience MySQL. As for MySQL, I don’t need to mention it here, which is probably familiar to all of you. After I started my job, I found that different companies chose different databases. Some chose Oracle, some chose MySQL, and some chose PostgreSQL. Oracle is very good, but it is always charged. It is too expensive for small companies to use, so people prefer MySQL. There are many tutorials and knowledge sharing blogs about MySQL, and they are written in great detail, so I won’t go into them here. Today we’re going to talk about another database, PostgreSQL, and take a look at it.
PostgreSQL installed
What is a PostgreSQL
The preparatory work
With that in mind, let’s take a look at how to install PostgreSQL.
Before the formal installation process, we need to prepare the installation package, here I mainly use Windows platform as an example, theoretically speaking, generally applicable to all Windows systems.
The first thing you need to do is go to www.postgresql.org/ to download the latest PostgreSQL installation package.
Select the corresponding platform to download the installation package. The.exe installation package is provided here. You can also download the.zip installation package to install the.exe installation package.
The installation process
With the preparations in place, it’s time for the official installation process.
- Double-click the installation package we downloaded, enter the installation interface, the first is a welcome interface, directly
Next
The next step;
- The next step is to select the installation path, which defaults to in
C:\Program Files\PostgreSQL\13
Below, but we generally recommend to install to their usual place to install software, do not directly install in C disk;
- Select the components you want to install. The default is to install all of them. If you have special requirements, click on them by default
Next
The next step;
- Select the location where the data is stored. The default is in the installation directory
data
Subdirectory, if you previously customized the installation path in Step 2, then select it directly hereNext
The next step;
- Set the password, which is the password we need to log in after the installation, here you can set yourself (must remember!). ;
- Port Settings. The default PostgreSQL port is 5432. If you don’t want to use the default port, you can customize the port you want to use.
- It’s just a time zone selection, and I’m going to click on it by default
Next
The next step;
- Then there’s the confirmation message to make sure we’re ready to start the PostgreSQL installation, just click
Next
The next step;
- The next step is the relatively long installation process, here you can wait;
- Ok, this screen shows that our installation process is finished, click
Finish
The installation is complete.
validation
Now that we have PostgreSQL installed, it’s time to see how to use it.
Go to our program list and find SQL Shell(PSQL), which is the program shown in the following figure to open (here I have installed the quick search software, so your search interface will be different from mine, but the software is the same).
Then login process, the first is the Server, that is, the database URL, default is local (so localhost), nothing to move directly enter the next step.
And then Database, which is our Database, and by default we’re going to use Postgres, because we’re logging in for the first time, so we’re just going to go ahead and hit enter.
The default Port number is 5432. If you changed it during installation, you’d better change it to the Port you changed at that time, otherwise the connection may fail.
Username is a PostgreSQL user, which is the default superuser (postgres, which is not the default root user).
The last thing to input is the password, which is the password to log in to the database, here we have been set on the top, directly input and enter.
If we have logged in successfully, we will be prompted as shown in the figure below.
conclusion
OK, that’s the end of today’s article. I’ve been covering how to install PostgreSQL on Windows, a little introduction to PostgreSQL, and how to verify that the installation is successful.
Originality is not easy, if you think this article is helpful to you, then give a thumbs-up and follow it.