MySQL License charges become more and more realistic. PostgreSQL has become the best alternative.
Deployment environment: CentOS6.3 x64.
PostgreSQL version: 9.2.4-1.
The CentOS Develop package Mode line may already have a PostgreSQL database, but the version is old. Here we need to deploy a new one.
The official website provides many deployment methods. Here I chose the offline installation package for command line interaction, because it can be installed without the network and operating system UI, which is close to the production environment.
Offline package download address: http://community.openscg.com/se/postgresql/packages.jsp
Download the corresponding OS package, grant the execution permission, and execute the package to complete the installation. During installation, some default storage directories will be set interactively. If there are no special requirements, press enter by default.
The installation can be completed quickly.
START database
It cannot be started by the root user. You need to use the new user created during installation. The default value is postgres.
Bin> S-D data
-D: specifies the configuration file and data storage directory. This directory must exist and contain the S. conf configuration file. After installation in the preceding method, you only need to specify the data folder under the installation directory.
If the directory does not exist, initialize the directory.
> Initdb-D Directory
If you need to remotely access the database, you need to modify the pg_cmd.conf file to grant the access permission to the specified host and ip address. In fact, the configuration in postgresql. conf affects access, but permissions are enabled by default.
After startup, you can use
> Psql
Connect the client to the database to view the database information. You can use help to view specific commands.