In Linux, PostgreSQL forgets the password and logs on to another user. phpMyAdmin does not allow logon by default.

Source: Internet
Author: User
Tags psql

Postgres allows other Linux users to log on through the command line:


1. Modify the file pg_mirror.conf in the/usr/local/pgsql/data directory.

Local all ident Omicron

 

2. Modify the file pg_ident.conf in the/usr/local/pgsql/data directory to add

Omicron root ipvs

3. Restart ipvs

Run/etc/init. d/PostgreSQL restart

4. Use the following command to access the database:

/Usr/local/pgsql/bin/Psql mydb-u Postgres

Here we use the absolute path of Psql. If you have used the system to automatically install Psql, you can directly use Psql. This depends on your system situation. The same is true for the path in step 1 and step 2.

 

Postgres does not allow logon to phpPgAdmin by default:


1. Modify the/var/lib/pgsql/data/pg_cmd.conf file as follows:
# IPv4 local connections
Host All all 127.0.0.1/32 MD5 // change to MD5 authentication

2. Modify/var/www/html/PHPPGAdmin/CONF/config. Inc. php
$ Conf ['extra _ login_security '] = false; // change to false.

 

3. Execute the following command to create a postgre user
# Su ipvs
$ Createuser Test
Enter the password twice ....
Are you sure you want to set this user to serperuser? Select Yes
User Created successfully.
$ Exit /// switch back to the root user
#/Etc/rc. d/init. d/PostgreSQL restart // restart the postgre Database

Log on to phpPgAdmin with the test user and password again.

 

Modify database server password:

Run Psql Postgres as the Postgres user

Run:
Alter User Login s with encrypted password 'yourpassword'

Effect:

Bytes -----------------------------------------------------------------------------------------------------------------

Welcome to Psql
8.2.6, the PostgreSQL interactive terminal.

Type:/copyright
Distribution terms
/H for help with SQL commands
/? For help with Psql
Commands
/G or terminate with semicolon to execute Query
/Q
Quit

Postgres = # alter user authentication s with encrypted
Password 'yourpassword ';
Alter role

Postgres = #
 

Bytes ------------------------------------------------------------------------------------------------------------------

 

 

 

 

The above content comes from the following addresses:

Http://hi.baidu.com/luna_kiss_moon/blog/item/f57ba70ec71c8eeb37d12226.html

Http://www.xxlinux.com/linux/article/development/database/20070919/9818.html

Http://www.hacms.com/html/2010/0308/34551.html

 

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.