欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

psql登录时的一点故事(实例)

程序员文章站 2022-04-12 20:06:43
psql登录时的一点故事(实例) [root@pgserver ~]# ps -ef |grep postg postgres 1074 1 0 mar22 ? 00...

psql登录时的一点故事(实例)

[root@pgserver ~]# ps -ef |grep postg
postgres  1074     1  0 mar22 ?        00:00:08 /usr/local/pgsql/bin/postgres
postgres  1076  1074  0 mar22 ?        00:00:00 postgres: checkpointer process  
postgres  1077  1074  0 mar22 ?        00:00:10 postgres: writer process   
postgres  1078  1074  0 mar22 ?        00:00:10 postgres: wal writer process  
postgres  1079  1074  0 mar22 ?        00:00:14 postgres: autovacuum launcher process  
postgres  1080  1074  0 mar22 ?        00:00:19 postgres: stats collector process  
postgres  1081  1074  0 mar22 ?        00:00:00 postgres: bgworker: logical replication launcher  
root     25924 25899  0 18:11 pts/2    00:00:00 grep --color=auto postg
pg102    27582     1  0 mar25 ?        00:00:01 /usr/local/pg102/bin/postgres
pg102    27584 27582  0 mar25 ?        00:00:00 postgres: checkpointer process  
pg102    27585 27582  0 mar25 ?        00:00:04 postgres: writer process   
pg102    27586 27582  0 mar25 ?        00:00:04 postgres: wal writer process  
pg102    27587 27582  0 mar25 ?        00:00:03 postgres: autovacuum launcher process  
pg102    27588 27582  0 mar25 ?        00:00:04 postgres: stats collector process  
pg102    27589 27582  0 mar25 ?        00:00:00 postgres: bgworker: logical replication launcher  
[root@pgserver ~]# su - pg102
last login: wed mar 21 02:38:36 edt 2018 on pts/1
[pg102@pgserver ~]$ psql
psql: fatal:  role "pg102" does not exist
[pg102@pgserver ~]$ history
    1  exit
    2  /usr/local/pg102/bin/initdb -d /usr/local/pg102/data
    3  wzir
    4  exit
    5  ls -rlt
    6  vi .bash_profile 
    7  exit
    8  pg_ctl start
    9  exit
   10  vi .bash_profile
   11  exit
   12  pg_ctl start
   13  pg_ctl stop
   14  cd $pgdata
   15  ls -lrt
   16  cd postgresql.conf 
   17  vi postgresql.conf 
   18  pg_ctl start
   19  ps -ef |grep postg
   20  pwd
   21  make install use_pgxs=1
   22  exit
   23  which pg_config
   24  pg_config --pgxs
   25  man pg_config
   26  exit
   27  make install use_pgxs=1
   28  cd 
   29  cd /root/
   30  exit
   31  cd /tmp/pg_query_state-pg10
   32  ls -lrt
   33  make install use_pgxs=1
   34  cd /usr/local/pgsql
   35  ls -lrt
   36  cd include
   37  ls -lrt
   38  pg_ctl stop
   39  pwd
   40  cd ..
   41  ls -lrt
   42  exit
   43  ll
   44  tar -xvf postgresql-10.2.tar 
   45  exit
   46  ll
   47  unzip pg_query_state-pg10.zip 
   48  cd postgresql-10.2
   49  ls -lrt
   50  cd /home/
   51  ls -lrt
   52  cd pg102
   53  ls -lrt
   54  cd postgresql-10.2
   55  git apply /home/pg102/pg_query_state-pg10/*.zip
   56  git apply /home/pg102/pg_query_state-pg10/*.patch
   57  ./configure --prefix=/usr/local/pg102
   58  make
   59  su
   60  make install use_pgxs=1
   61  ls -lrt /usr/local/pg102/lib/postgresql/pgxs/src/makefiles/pgxs.mk
   62  ls -lrt  /usr/local/pg102/lib/postgresql/pgxs/src/makefiles/../../src/makefile.global
   63  cd  /usr/local/pg102/lib/postgresql/pgxs/src/makefiles/
   64  pwd
   65  ls -lrt
   66  cd ..
   67  ls -lrt
   68  cd ..
   69  ls -lrt
   70  cd ..
   71  ls -lrt
   72  pwd
   73  cd pgxs
   74  ls -lrt
   75  cd src
   76  ls -lrt
   77  cd makefiles/
   78  ls -lrt
   79  cd ..
   80  ls -lrt
   81  cd ..
   82  pwd
   83  ls -lrt
   84  cd ..
   85  ls -lrt
   86  pwd
   87  cd ..
   88  ls -lrt
   89  pwed
   90  pwd
   91  find . -name makefile.global
   92  find . -name makefile
   93  find . -name "makefile"
   94  find . -name makefile
   95  ls -lrt
   96  make install 
   97  make install
   98  pwd
   99  ls -lrt
  100  cd postgresql-10.2
  101  ls -lrt
  102  make install
  103  cd ..
  104  ls -lrt
  105  cd pg_query_state-pg10
  106  ls -lrt
  107  make install use_pgxs=1
  108  cd /usr/local/pg102/data
  109  mkdir /usr/local/pg102/data
  110  chown pg102 /usr/local/pg102/data
  111  /usr/local/pg102/bin/initdb -d /usr/local/pg102/data
  112  pg_ctl start
  113  pg_ctl stop
  114  cd $pgdata
  115  ls -lrt
  116  vi postgresql.conf 
  117  pg_ctl start
  118  pwd
  119  ps -ef |grep postg
  120  cd
  121  ll
  122  cd $pgdata
  123  vi postgresql.conf 
  124  pg_ctl restart
  125  psql
  126  psql --help
  127  psql -p 5532
  128  psql -p 553
  129  psql -p 5532
  130  pwd
  131  psql -h 192.168.80.148 -p 5532
  132  cat /etc/hosts
  133  exit
  134  psql --help
  135  psql -h 192.168.80.148 -p 5532 -u postgres
  136  pg_ctl status
  137  ifconfig |more
  138  psql -h 192.168.80.148 -p 5532 -u postgres
  139  pg_ctl status
  140  cd $pgdata
  141  ls -lrt
  142  more postmaster.pid 
  143  pg_ctl stop
  144  pg_ctl start
  145  psql -h 127.0.0.1 -p 5532 -u postgres
  146  psql -h 127.0.0.1 -p 5532
  147  psql -h 127.0.0.1 -p 5532 -u postgres
  148  psql -h 127.0.0.1 -p 5532 -u pg102
  149  pslq --help
  150  psql --help
  151  psql -v
  152  psql -b
  153  psql -v
  154  ls -lrt
  155  cd base
  156  ls -lrt
  157  cd 1
  158  ls -lrt
  159  cd ..
  160  ls -lrt
  161  cd 13211
  162  ls -lrt
  163  cd ..
  164  ls -lrt
  165  cd ..
  166  ls -lrt
  167  cd global/
  168  ls -lrt
  169  more pg_control
  170  cd ..
  171  ls -lrt
  172  pwd
  173  psql
  174  psql -h 127.0.0.1 -p 5532
  175  psql -h 127.0.0.1 -p 5532 -u root
  176  psql -h 127.0.0.1 -p 5532 -u postgres
  177  psql -h 127.0.0.1 -p 5532 -u pg102
  178  psql -h 127.0.0.1 -p 5532
  179  su - podtgres
  180  su - postgres
  181  exit
  182  env |grep pg
  183  psql -p 5532 -u pg102 -d postgres
  184  psql -p 5532 -u pg102 -d postgres
  185  ls -lrt
  186  cd pg_query_state-pg10
  187  ls -lrt
  188  cd tests
  189  ls -lrt
  190  python
  191  ps -ef |grep local
  192  psql -p 5532 -u pg102 -d postgres
  193  psql
  194  history
  195  psql -p 5532 -u pg102 -d postgres
  196  env |grep pgdata
  197  pg_ctl start
  198  psql -p 5532 -u pg102 -d postgres
  199  psql -p 5532  -d postgres
  200  psql -d postgres
  201  psql -p 5532  -d postgres
  202  psql --help
  203  history
  204  psql --help
  205  ll
  206  cd postgresql-10.2
  207  ls
  208  ./configure --help
  209  psql
  210  history
[pg102@pgserver ~]$ psql -p 5532 
psql: fatal:  database "pg102" does not exist
[pg102@pgserver ~]$ psql -p 5532 -u pg102
psql: fatal:  database "pg102" does not exist
[pg102@pgserver ~]$ psql -p 5532 -u pg102 -d postgres
psql (10.2)
type "help" for help.

postgres=#