티스토리 뷰

Developer

[ console ] commands

rocksea 2012. 10. 8. 11:37

 

console 접속 명령

# su - postgres

# psql

 

 

  # show a list of databases

        \l

    # show users

        select * from pg_user;

    # show all tables (including system tables)

        select * from pg_tables;

    # show tables in the current context (database/schema)

        \d

    # change current database

       \c database;

    # show all schemas in the current database

        \dn

    # Grant permissions on a schema to a user

        GRANT ALL ON myschema TO user;

    # show help

        \?

    # copy a table to a tab delimeted file

        COPY table TO ‘table.txt’;

    # load a table from a tab delimeted file

        COPY table FROM ‘table.txt’;

    # show permissions on database objects

        \z [object]

        r — SELECT (“read”)
        w — UPDATE (“write”)
        a — INSERT (“append”)
        d — DELETE
        R — RULE
        x — REFERENCES (foreign keys)
        t — TRIGGER
        X — EXECUTE
        U — USAGE
        C — CREATE
        T — TEMPORARY
        arwdRxt — ALL PRIVILEGES (for tables)
        * — grant option for preceding privilege
        /yyyy — user who granted this privilege

    # Run the vacuum utility

        vacuumdb –verbose –analyze –all

'Developer' 카테고리의 다른 글

like문 작성법  (0) 2012.10.10
[ expect ] telnet, ssh 자동화 script  (0) 2012.10.09
maven + spring framework 연동하기  (0) 2012.10.04
[ Perl ] FTP Upload  (0) 2012.09.28
Heuristic  (0) 2012.09.25
댓글