$ Sudo su-postgres $ Psql S = # create user yy with password 'yy '; CREATE ROLE Postgres = # create database blogbase; CREATE DATABASE Postgres = # grant all privileges on database blogbase to yy; GRANT Change user password Alter user username with password 'new password '; ALTER ROLE Log on to the database Psql-U yy-d blogbase-h 127.0.0.1 -U: specifies the user,-d: specifies the database,-h: specifies the server, if any port is specified with-p After executing the preceding command, if a statement such as "Password for user yy:" is displayed, you can enter the Password. After entering the Password, the logon is successful. Rename a database Alter database blogbase rename to blogbase1; Service # Viewing status Sudo/etc/init. d/postgresql status # Start Sudo/etc/init. d/postgresql start # Stop Sudo/etc/init. d/postgresql stop # Restart Sudo/etc/init. d/postgresql restart |