Postgresql DB Installation and usage issue record

Source: Internet
Author: User
Tags postgresql psql file permissions

2. Prompt after selecting the language:

Error:there have been an error.

Please put the SELinux in permissive mode and then run installer again. SELinux can

Be put in enforcing mode again after installation.

Press [Enter] to continue:

Solution:

Need to temporarily close SELinux

Setenforce 0 # #设置SELinux become permissive mode

# #setenforce 1 set SELinux to become enforcing mode

3. All instructions, such as Pg_ctrl tips:

-bash:pg_ctrl:command not found

Solution:

Such instructions must be accompanied by a path, even in the current directory./pg_ctl

You can set environment variables to resolve:

Export Path=/opt/postgresplus/9.2as/bin: $PATH

4.pg_ctl and other instruction prompt:

Pg_ctl:no database directory specified and environment variable PGDATA unset

Solution:

Environment variables need to be set:

Export Pgdata=/opt/postgresplus/9.2as/data

5. There was a problem with the remote connection database after the installation was completed: Error encountered while performing the requested operation: IO error: Got minus one from a read call

On-line check, plan to modify the opt/postgresplus/9.2as/data|pg_hba.conf configuration file, but the current user does not have permissions

Plan to switch to PostgreSQL users and find that they have forgotten their password

Change password with passwd command, login successful

pg_hba.conf file Add line: Host all 0.0.0.0/0 Trust

Restart the database with Pg_ctl restart

Modify the server Data/postgresql.conf file to

#listen_address = ' localhost ' changed to listen_addresses = ' * '

6.restart failed to close database

As prompted, add parameters: Pg_ctl restart-m Fast

7. Reboot failed, start also failed, hint

2014-10-12 00:06:56 CST Fatal error: The Data directory "/opt/postgresplus/9.2as/data" is accessible to groups or other users

2014-10-12 00:06:56 CST Details: The permission should be u=rwx (0700).

Solution:

Modify permissions: chmod 0700 data

Switch to a user with root privileges,
1. First put the folder "/var/lib/pgsql/9.3/data" The user belongs to the group, to Postgres users:

Enter the/var/lib/pgsql/9.3 directory
cd/var/lib/pgsql/9.3
Chown-r postgres:postgres Data

2. Change all current file and subdirectory file permissions of data to: rwx (0700)

Chmod-r 0700 Data

Restart the PostgreSQL database for problem resolution.

1.postgresql Start error Pg_ctl:pid file "/database/data/postmaster.pid" does not exist

Solution:

Cause:/pgdata directory permissions issue, Chown-r Postgres:root/pgdata, successfully resolved

8. Start Error:

2014-10-12 00:22:33 CST log: Loaded library "$libdir/dbms_pipe"

2014-10-12 00:22:33 CST log: Loaded library "$libdir/edb_gen"

2014-10-12 00:22:33 CST log: Unable to create IPV6 socket: Address family not supported by protocol

Started to think it was a IPv6 problem, and later, according to the following prompts, view the log:

2014-10-12 01:39:15 CST log: Invalid authentication method "127.0.0.1/32"

2014-10-12 01:39:15 CST Context: 82nd line of configuration file "/opt/postgresplus/9.2as/data/pg_hba.conf"

2014-10-12 01:39:15 CST fatal error: Unable to load pg_hba.conf

Solution:

is a pg_hba.conf problem, the check is 5 configuration error, change the configuration to:

Host All 0.0.0.0/0 MD5

Startup success

9. Login Error:

-bash-4.1$ Psql

Password:

Psql: Fatal error: User "Enterprisedb" Password authentication failed

Solution:

The host all 0.0.0.0/0 MD5

Change to host all 0.0.0.0/0 Trust

Allow User name password authentication

10. After the last, input psql hint enterprisedb does not exist

If you enter Psql directly, the name of the database that matches the current user name is searched by default, but there is no database

Should be entered: Psql template1

Success:

template1=#

After entry: Create DATABASE Enterprisedb

Or do not enter the database, with createdb instructions

And then psql to go straight into enterprisedb.

To view an existing database:

enterprisedb=# select Oid,datname from Pg_database;

OID | Datname

-------+--------------

1 | Template1

14077 | Template0

14082 | Postgres

14083 | Edb

16384 | Enterprisedb

(5 rows)

11. Delete the data directory and re-initdb the database

Solution:

In the Data directory: RM-RF *

Then Initdb set up a new database

12. Modify the password for Enterprisedb

It is important to note that the Enterprisedb may be a Linux password or a database password, which is the database password.

postgres=# ALTER USER enterprisedb with password ' admin ';

13. How to exit after entering the database:

template1=# quit

14. Create and delete users:

CreateUser is the encapsulation of the SQL command CREATE user.

Dropuser Deleting a user

Postgresql DB Installation and usage issue record

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.