<< 程式可以掃瞄Port號IP等,算是一個網路掃瞄程式,注意別去掃一些不該 | 回blog首頁 |
MYSQL安裝套件,通常還會依機器型號不同,而版本會有所不同,但大概就是這幾個(建議灌系統就安裝,RedHat有包進MySQL) >>
October 25,2006
PostgreSQL安裝及基本備份操作
PostgreSQL安裝套件及過程:(refreence by INSTALL in the Postgresql-8.1.4 directory )
version: Postgresql-8.1.4
四組tar.gz檔(均要,缺一不可)
postgresql-8.1.4.tar.gz
postgresql-opt-8.1.4.tar.gz
postgresql-base-8.1.4.tar.gz
postgresql-test-8.1.4.tar.gz
shell> tar -zxvf postgresql-*
需要相關套件(dependency)
ISO/ANSI C compiler
GNU Readline library(如無,可在configure 時加--without-readline)
zlib compression library (如無,可在configure 時加----without-zlib)
Step1:
./configure
Step2:
make
出現All of PostgreSQL is successfully made. Ready to install.才成功,若否,準備讀手冊吧!!
Step3:
make install
接下來設環境變數(~/.bash_prfile)
LD_LIBRARY_PATH=/usr/local/pgsql/lib
export LD_LIBRARY_PATH
PATH=/usr/local/pgsql/bin:$PATH
export PATH
MANPATH=/usr/local/pgsql/man:$MANPATH
export MANPATH
接下來開一個progres的帳號
root# mkdir /usr/local/pgsql/data
root# chown postgres /usr/local/pgsql/data
root# chown postgres /usr/local/pgsql/bin (建議…這樣才能用postgres直接執行相關指令)
root# su - postgres
postgres$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data
PostgreSQL Server 開啟指令(excute in the background)
nohup /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data \
>server.log 2>&1 PostgreSQL Server 關閉指令
kill `cat /usr/local/pgsql/data/postmaster.pid`
進DB
[shell]psql
連結(選擇)db
postgres=#\c dbname
看所有db
postgres=#\l
看某db中的所有table、view
postgres=#\z
備份
pg_dump DBname | gzip > Filename(整個table)
pg_dump -a DBname | gzip > Filename(資料)
還原
gzip -cd Filename.gz | psql DBname(整個table)
gzip -cd Filename.gz | psql -a DBname(資料)
其他SQL指令 postgres=#\h
其他psql指令 postgres=#\?
postgres=# 當=號變-號表示指令沒下完,通常加個comment(;)就好了
version: Postgresql-8.1.4
四組tar.gz檔(均要,缺一不可)
postgresql-8.1.4.tar.gz
postgresql-opt-8.1.4.tar.gz
postgresql-base-8.1.4.tar.gz
postgresql-test-8.1.4.tar.gz
shell> tar -zxvf postgresql-*
需要相關套件(dependency)
ISO/ANSI C compiler
GNU Readline library(如無,可在configure 時加--without-readline)
zlib compression library (如無,可在configure 時加----without-zlib)
Step1:
./configure
Step2:
make
出現All of PostgreSQL is successfully made. Ready to install.才成功,若否,準備讀手冊吧!!
Step3:
make install
接下來設環境變數(~/.bash_prfile)
LD_LIBRARY_PATH=/usr/local/pgsql/lib
export LD_LIBRARY_PATH
PATH=/usr/local/pgsql/bin:$PATH
export PATH
MANPATH=/usr/local/pgsql/man:$MANPATH
export MANPATH
接下來開一個progres的帳號
root# mkdir /usr/local/pgsql/data
root# chown postgres /usr/local/pgsql/data
root# chown postgres /usr/local/pgsql/bin (建議…這樣才能用postgres直接執行相關指令)
root# su - postgres
postgres$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data
PostgreSQL Server 開啟指令(excute in the background)
nohup /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data \
>server.log 2>&1 PostgreSQL Server 關閉指令
kill `cat /usr/local/pgsql/data/postmaster.pid`
進DB
[shell]psql
連結(選擇)db
postgres=#\c dbname
看所有db
postgres=#\l
看某db中的所有table、view
postgres=#\z
備份
pg_dump DBname | gzip > Filename(整個table)
pg_dump -a DBname | gzip > Filename(資料)
還原
gzip -cd Filename.gz | psql DBname(整個table)
gzip -cd Filename.gz | psql -a DBname(資料)
其他SQL指令 postgres=#\h
其他psql指令 postgres=#\?
postgres=# 當=號變-號表示指令沒下完,通常加個comment(;)就好了
引用URL
http://cgi.blog.roodo.com/trackback/2364269