新聞中心
數(shù)據(jù)庫是計(jì)算機(jī)系統(tǒng)中最重要的軟件之一。它們負(fù)責(zé)存儲(chǔ)和管理數(shù)據(jù),是企業(yè)和機(jī)構(gòu)管理數(shù)據(jù)和信息的主要工具。而達(dá)夢(mèng)數(shù)據(jù)庫是一種先進(jìn)的、高性能的數(shù)據(jù)庫系統(tǒng),是國內(nèi)近年來興起的一種數(shù)據(jù)庫,它具有松耦合、高安全性、高可用性等特點(diǎn),受到許多企業(yè)和機(jī)構(gòu)的青睞。本文將介紹在Linux上安裝達(dá)夢(mèng)數(shù)據(jù)庫的步驟,幫助讀者輕松掌握。

成都創(chuàng)新互聯(lián)公司公司2013年成立,先為灤州等服務(wù)建站,灤州等地企業(yè),進(jìn)行企業(yè)商務(wù)咨詢服務(wù)。為灤州企業(yè)網(wǎng)站制作PC+手機(jī)+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問題。
一、下載達(dá)夢(mèng)數(shù)據(jù)庫軟件包
在安裝達(dá)夢(mèng)數(shù)據(jù)庫之前,首先需要下載安裝包。讀者可以在達(dá)夢(mèng)官方網(wǎng)站(www.dameng.com)下載符合自己系統(tǒng)版本的安裝包,并將其解壓至指定的目錄下,以便進(jìn)行安裝。
二、配置系統(tǒng)環(huán)境變量
在進(jìn)行達(dá)夢(mèng)數(shù)據(jù)庫安裝之前,需要先配置好系統(tǒng)環(huán)境變量。具體方法如下:
1. 打開終端操作界面,輸入“vi /etc/profile”,進(jìn)入編輯狀態(tài)。
2. 在文件末尾添加如下內(nèi)容:
export DMHOME=/opt/dameng
export PATH=$DMHOME/bin:$PATH
其中,DMHOME變量表示達(dá)夢(mèng)數(shù)據(jù)庫安裝路徑,可以根據(jù)實(shí)際情況進(jìn)行修改。
3. 保存文件并退出編輯狀態(tài),執(zhí)行“source /etc/profile”命令,使環(huán)境變量生效。
三、創(chuàng)建達(dá)夢(mèng)數(shù)據(jù)庫實(shí)例
在完成前兩個(gè)步驟之后,就可以開始創(chuàng)建達(dá)夢(mèng)數(shù)據(jù)庫實(shí)例了。具體操作如下:
1. 進(jìn)入達(dá)夢(mèng)安裝包解壓后的bin目錄,執(zhí)行如下命令:
./dmadmin -create scott tiger -inst test -f /opt/dameng/test -size 300m -pro UNSHRD
這條命令的含義是:創(chuàng)建一個(gè)名為test的數(shù)據(jù)庫實(shí)例,用戶名/密碼為scott/tiger,實(shí)例保存路徑為/opt/dameng/test,數(shù)據(jù)庫大小為300兆,使用非共享模式。
2. 創(chuàng)建完成后,執(zhí)行如下命令啟動(dòng)實(shí)例:
./dmctl -start test
這個(gè)命令的含義是啟動(dòng)名為test的實(shí)例。
四、測(cè)試達(dá)夢(mèng)數(shù)據(jù)庫的連接
在達(dá)夢(mèng)數(shù)據(jù)庫實(shí)例啟動(dòng)后,可以進(jìn)行一些基本的測(cè)試來確認(rèn)它們正在正常工作。具體方法如下:
1. 打開終端操作界面,執(zhí)行如下命令,進(jìn)入達(dá)夢(mèng)數(shù)據(jù)庫服務(wù)界面:
./dmcli
2. 進(jìn)入服務(wù)界面后,依次輸入以下命令:
connect scott/tiger@test;
select sysdate from dual;
如果系統(tǒng)返回了當(dāng)前時(shí)間,則說明達(dá)夢(mèng)數(shù)據(jù)庫已經(jīng)成功運(yùn)行,并且可以正常連接。
五、管理達(dá)夢(mèng)數(shù)據(jù)庫實(shí)例
在達(dá)夢(mèng)數(shù)據(jù)庫安裝完成后,需要進(jìn)行一些管理工作,以確保它們長期穩(wěn)定運(yùn)行。具體方法如下:
1. 停止達(dá)夢(mèng)數(shù)據(jù)庫實(shí)例:
./dmctl -stop test
2. 修改達(dá)夢(mèng)數(shù)據(jù)庫實(shí)例:
./dmadmin -modify scott tiger -inst test -m extent -x 100
這個(gè)命令的含義是:修改名為test的數(shù)據(jù)庫實(shí)例,增加數(shù)據(jù)塊數(shù)量至100。
3. 刪除達(dá)夢(mèng)數(shù)據(jù)庫實(shí)例:
./dmadmin -delete scott tiger -inst test
這個(gè)命令的含義是:刪除名為test的數(shù)據(jù)庫實(shí)例。
六、
本文介紹了在Linux系統(tǒng)上安裝達(dá)夢(mèng)數(shù)據(jù)庫的步驟,希望可以幫助讀者輕松掌握。達(dá)夢(mèng)數(shù)據(jù)庫是一種高性能、高可用性的數(shù)據(jù)庫系統(tǒng),將為企業(yè)和機(jī)構(gòu)提供可靠的數(shù)據(jù)管理服務(wù)。
相關(guān)問題拓展閱讀:
- 怎樣在Linux環(huán)境下安裝部署MySQL數(shù)據(jù)庫系統(tǒng)
怎樣在Linux環(huán)境下安裝部署MySQL數(shù)據(jù)庫系統(tǒng)
創(chuàng)建用于執(zhí)行mysql服務(wù)程序的帳號(hào):# cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld# chmod 755 /etc/init.d/mysqld# chkconfig mysqld on編輯啟動(dòng)項(xiàng)的配置文件:# vim /etc/rc.d/init.d/mysqld //分別修改第46與47行,basedir為程序安裝路徑,datadir為數(shù)據(jù)庫存放目錄。basedir=/usr/local/mysqldatadir=/usr/local/mysql/var重啟mysqld服務(wù)程序:# service mysqld startStarting MySQL. SUCCESS! 把mysql服銷鋒務(wù)程序命令目錄添加到環(huán)襪斗判境變量中(永久生效):# vim /etc/profile//在配置文件的最下面告改追加:export PATH=$PATH:/usr/local/mysql/bin# source /etc/profile將mysqld服務(wù)程序的庫文件鏈接到默認(rèn)的位置:# mkdir /var/lib/mysql# ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql# ln -s /usr/local/mysql/include/mysql /usr/include/mysql# ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock初始化mysqld服務(wù)程序:# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQLSERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFUL!In order to log into MySQL to secure it, we’ll need the currentpassword for the root user. If you’ve just installed MySQL, andyou haven’t set the root password yet, the password will be blank,so you should just press enter here.Enter current password for root (enter for none): OK, successfully used password, moving on…Setting the root password ensures that nobody can log into the MySQLroot user without the proper authorisation.Set root password? y New password: 輸入要為root用戶設(shè)置的數(shù)據(jù)庫密碼。Re-enter new password: 重復(fù)再輸入一次密碼。Password updated successfully!Reloading privilege tables.. … Success!By default, a MySQL installation has an anonymous user, allowing anyoneto log into MySQL without having to have a user account created forthem. This is intended only for testing, and to make the installationgo a bit oother. You should remove them before moving into aproduction environment.Remove anonymous users? y(刪除匿名帳號(hào)) … Success!Normally, root should only be allowed to connect from ‘localhost’. Thisensures that someone cannot guess at the root password from the network.Disallow root login remotely? y(禁止root用戶從遠(yuǎn)程登陸) … Success!By default, MySQL comes with a database named ‘test’ that anyone canaccess. This is also intended only for testing, and should be removedbefore moving into a production environment.Remove test database and access to it? y(刪除test數(shù)據(jù)庫并取消對(duì)其的訪問權(quán)限) – Dropping test database… … Success! – Removing privileges on test database… … Success!Reloading the privilege tables will ensure that all changes made so farwill take effect immediately.Reload privilege tables now? y(刷新授權(quán)表,讓初始化后的設(shè)定立即生效) … Success!All done! If you’ve completed all of the above steps, your MySQLinstallation should now be secure.Thanks for using MySQL!Cleaning up…可以百度搜索Linux就該這么學(xué),第9章 使用Apache服務(wù)部署靜態(tài)網(wǎng)站,里面有部署mysql的資料
在Linux安裝軟件需要預(yù)先做好如下一些準(zhǔn)備:準(zhǔn)備好Linux操作系統(tǒng)如:CentOS7。配置好yum源。
完成如野上述準(zhǔn)備后,就可以動(dòng)手安裝MySQL數(shù)據(jù)庫了。主要安裝步驟如下:
1. 禁用selinux
setenforce 0
2. 上傳安裝文件到Linux
3.解壓rpm包
tar -xvf mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar
4.安裝軟件
yum install mysql-community-{libs,client,common,server}-*.rpm
5.啟動(dòng)mysql數(shù)據(jù)庫初始化
systemctl start mysqld
6.修改vi /etc/my.cnf
添加:
#可以在表中錄入中文
character-set-server=utf8 #
explicit-defaults-for-timestamp
# 禁用當(dāng)前密碼認(rèn)證策略,可以使用簡(jiǎn)單密碼(生產(chǎn)環(huán)境不適用)
validate_password=0
7.重啟mysql服務(wù)
systemctl restart mysqld
8.找臨時(shí)登錄密碼
grep -i “temporary password” /var/log/mysqld.log
9.連接MySQL數(shù)據(jù)庫
mysql -uroot -p 輸入臨時(shí)密碼
10.修改root用戶登錄密碼為簡(jiǎn)單密碼(生產(chǎn)環(huán)境不適用)
alter user root@localhost identified by ”;
11.配置MYSQL_PS1環(huán)境變量
修改家目錄下:.bash_profile文件,添加
export MYSQL_PS1=”\u@\h>”
12.使新環(huán)境變?cè):傲可?/p>
source /root/.bash_profile
13.重新連接mysql驗(yàn)證
mysql -uroot -p
除了上述安裝方式以外,可能在公司中會(huì)遇到安裝指定版本的需求,那么如何安裝指定版本的MySQL數(shù)據(jù)呢?這時(shí)我們可以采用下載指定版本安裝包進(jìn)行安裝的方式,主要步驟如下,假設(shè)CentOS7 linux最小安裝,已經(jīng)配置好yum。首先檢查是否安裝numactl包
rpm -qa|grep numactl
yum install numactl-libs-* # 如果沒有安裝需要安裝。檢查是否安裝libaio包
rpm -qa|grep libaio
yum install libaio-* # 如果沒有安裝需要安裝
具體安裝步驟如下:
* 禁用selinux
setenforce 0
* 上傳安裝文件到Linux
mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz
* 創(chuàng)建mysql用戶組和用戶
groupadd -g 27 -r mysql
#-r創(chuàng)建系統(tǒng)賬戶,-M 不創(chuàng)建用戶家目錄 -N 不創(chuàng)建和用戶名一樣的用戶組
useradd -M -N -g mysql -r -s /bin/false -c “MySQL Server” -u 27 mysql
id mysql
* 上傳安裝包到root家目錄
* 解壓二進(jìn)制文件到/usr/local
tar -zxvf mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz -C /usr/local
* 解壓目錄改名為mysql
cd /usr/local
ls -l
mv mysql-5.7.26-linux-glibc2.12-x86_64/ mysql
* 環(huán)境變量中添加mysql/bin目錄
vi /root/.bash_profile
修改PATH=/usr/local/mysql/bin:$PATH:$HOME/bin
添加 export MYSQL_PS1=”\u@\h>”
source /碼碼root/.bash_profile
* 創(chuàng)建/usr/local/mysql/etc/my.cnf選項(xiàng)文件 (也可以使用默認(rèn)的/etc/my.cnf選項(xiàng)文件)
mkdir -p /usr/local/mysql/etc
mkdir -p /usr/local/mysql/mysql-files
* 編輯選項(xiàng)文件my.cnf填寫默認(rèn)選項(xiàng)
vi /usr/local/mysql/etc/my.cnf
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
socket=/usr/local/mysql/data/mysql.sock
log-error=/usr/local/mysql/data/mysqld.err
pid-file=/usr/local/mysql/data/mysqld.pid
secure_file_priv=/usr/local/mysql/mysql-files
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
Explicit-defaults-for-timestamp
character-set-server=utf8
socket=/usr/local/mysql/data/mysql.sock
* 初始化數(shù)據(jù)目錄
cd /usr/local/mysql
mkdir data
chmod 750 data
chown mysql:mysql data
* 初始化數(shù)據(jù)庫
cd /usr/local/mysql
bin/mysqld –defaults-file=/usr/local/mysql/etc/my.cnf –initialize
* 使用systemd管理mysql
例如:systemctl {start|stop|restart|status} mysqld
cd /usr/lib/systemd/system
touch mysqld.service
chmod 644 mysqld.service
vi mysqld.service
# 添加以下內(nèi)容
Description=MySQL Server
Documentation=man:mysqld(7)
Documentation=
After=network.target
After=syslog.target
WantedBy=multi-user.target
User=mysql
Group=mysql
Type=forking
PIDFile=/usr/local/mysql/data/mysqld.pid
# Disable service start and stop timeout logic of systemd for mysqld service.
TimeoutSec=0
# Start main service
ExecStart=/usr/local/mysql/bin/mysqld –defaults-file=/usr/local/mysql/etc/my.cnf –daemonize –pid-file=/usr/local/mysql/data/mysqld.pid $MYSQLD_OPTS
# Use this to switch malloc implementation
EnvironmentFile=-/etc/sysconfig/mysql
# Sets open_files_limit
LimitNOFILE = 65535
Restart=on-failure
RestartPreventExitStatus=1
PrivateTmp=false
以上內(nèi)容中注意:The –pid-file option specified in the my.cnf configuration file is ignored by systemd.
默認(rèn):LimitNOFILE = 5000,如果連接數(shù)(max_connection)需要調(diào)大,可以將LimitNOFILE 設(shè)置為更大65535
* 創(chuàng)建mysql.conf文件
cd /usr/lib/tmpfiles.d
#Add a configuration file for the systemd tmpfiles feature. The file is named mysql.conf and is placed in /usr/lib/tmpfiles.d.
cd /usr/lib/tmpfiles.d
touch mysql.conf
chmod 644 mysql.conf
* mysql.conf添加內(nèi)容
vi mysql.conf
添加以下語句:
d /usr/local/mysql/data 0750 mysql mysql –
* 使新添加的mysqld服務(wù)開機(jī)啟動(dòng)
systemctl enable mysqld.service
* 手動(dòng)啟動(dòng)mysqld
systemctl start mysqld
systemctl status mysqld
* 獲得mysql臨時(shí)登錄密碼
cat /usr/local/mysql/data/mysqld.err | grep “temporary password”
* 客戶端登錄連接mysql服務(wù)器
mysql -uroot -p
輸入臨時(shí)密碼
* 修改MySQL用戶root@localhost密碼
mysql> alter user root@localhost identified by ”; #此處為了方便設(shè)置為空密碼
* 測(cè)試新密碼連接MySQL服務(wù)
mysql -uroot -p
關(guān)于達(dá)夢(mèng)數(shù)據(jù)庫linux 安裝的介紹到此就結(jié)束了,不知道你從中找到你需要的信息了嗎 ?如果你還想了解更多這方面的信息,記得收藏關(guān)注本站。
創(chuàng)新互聯(lián)網(wǎng)絡(luò)推廣網(wǎng)站建設(shè),網(wǎng)站設(shè)計(jì),網(wǎng)站建設(shè)公司,網(wǎng)站制作,網(wǎng)頁設(shè)計(jì),1500元定制網(wǎng)站優(yōu)化全包,先排名后付費(fèi),已為上千家服務(wù),聯(lián)系電話:13518219792
本文名稱:輕松學(xué)會(huì)達(dá)夢(mèng)數(shù)據(jù)庫在Linux上的安裝方法(達(dá)夢(mèng)數(shù)據(jù)庫linux安裝)
新聞來源:http://www.dlmjj.cn/article/dpjgihj.html


咨詢
建站咨詢
