CentOS 6.9 下安裝DB2

來源:互聯網
上載者:User

標籤:密碼   examples   page   null   gre   預設   prim   group   地址   

作業系統:CentOS6.9_x64

DB2安裝檔案: db2_v101_linuxx64_expc.tar.gz

安裝資料庫
tar zxvf db2_v101_linuxx64_expc.tar.gzcd expc/./db2_install

選擇預設安裝路徑 : yes

設定資料庫

建立3個使用者組

groupadd -g 901 db2iadm1groupadd -g 902 db2fadm1groupadd -g 903 db2dadm1

建立3個使用者

useradd -g db2iadm1 -u 101 -d  /home/db2inst1 -m  db2inst1useradd -g db2fadm1 -u 102 -d  /home/db2fenc1 -m  db2fenc1useradd -g db2dadm1 -u 103 -d  /home/db2dasusr1 -m  db2dasusr1

添加3個使用者密碼

passwd db2inst1passwd db2fenc1passwd db2dasusr1

檢查使用者組和使用者是否建立成功

cat /etc/group | grep db2cat /etc/passwd | grep db2

建立執行個體

cd /opt/ibm/db2/V10.1/instance./dascrt -u db2dasusr1./db2icrt -a server -u db2fenc1 db2inst1

配置db2自啟動

cd /opt/ibm/db2/V10.1/instance./db2iauto -on db2inst1

配置db2網路服務連接埠

su - db2inst1 db2 update dbm cfg using SVCENAME 50000

修改DB2串連方式為TCP/IP

db2set DB2COMM=TCPIP
使用資料庫

啟動資料庫

su - db2inst1 db2start

建立資料庫

db2 create db testdb using codeset UTF-8 territory CN pagesize 8192

 

串連到資料庫:

db2 connect to testdb

 

顯示串連

db2 list applications

 

sql測試代碼:

create table tb1( id integer not null primary key,username varchar(200),password varchar(200));insert into tb1(id,username,password) values(188,‘stevenjohn‘,‘stevenanthony‘)  ;select * from tb1;drop table tb1;

python測試代碼:

https://github.com/mike-zhang/pyExamples/blob/master/databaseRelate/db2Opt/db2Test1.py

好,就這些了,希望對你有協助。

本文github地址:

https://github.com/mike-zhang/mikeBlogEssays/blob/master/2017/20170706_cenos6.9下安裝db2.rst

歡迎補充

CentOS 6.9 下安裝DB2

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.