新聞中心
CentOS6是一種免費(fèi)、開源的Linux操作系統(tǒng),適用于服務(wù)器和桌面應(yīng)用程序開發(fā)。隨著企業(yè)和組織對大數(shù)據(jù)的需求不斷增加,安裝數(shù)據(jù)庫已成為服務(wù)器設(shè)置的必要部分。本文將介紹在。

公司主營業(yè)務(wù):成都網(wǎng)站制作、成都做網(wǎng)站、移動(dòng)網(wǎng)站開發(fā)等業(yè)務(wù)。幫助企業(yè)客戶真正實(shí)現(xiàn)互聯(lián)網(wǎng)宣傳,提高企業(yè)的競爭能力。成都創(chuàng)新互聯(lián)是一支青春激揚(yáng)、勤奮敬業(yè)、活力青春激揚(yáng)、勤奮敬業(yè)、活力澎湃、和諧高效的團(tuán)隊(duì)。公司秉承以“開放、自由、嚴(yán)謹(jǐn)、自律”為核心的企業(yè)文化,感謝他們對我們的高要求,感謝他們從不同領(lǐng)域給我們帶來的挑戰(zhàn),讓我們激情的團(tuán)隊(duì)有機(jī)會(huì)用頭腦與智慧不斷的給客戶帶來驚喜。成都創(chuàng)新互聯(lián)推出孟津免費(fèi)做網(wǎng)站回饋大家。
選擇適合你的數(shù)據(jù)庫
在將數(shù)據(jù)庫安裝到CentOS6系統(tǒng)之前,你需要選擇一種適合你的數(shù)據(jù)庫。目前大多數(shù)企業(yè)和組織都選擇MySQL或PostgreSQL數(shù)據(jù)庫,因?yàn)樗鼈兪敲赓M(fèi)的、開源的和易于使用的數(shù)據(jù)庫。其他的數(shù)據(jù)庫包括Oracle、MongoDB和SQL Server。你需要根據(jù)你的需求選擇適合你的數(shù)據(jù)庫。
MySQL數(shù)據(jù)庫的安裝
MySQL數(shù)據(jù)庫是一個(gè)流行的、開源的關(guān)系型數(shù)據(jù)庫管理系統(tǒng)。它支持多用戶、多線程,并且能夠處理大量的數(shù)據(jù)。以下是在CentOS6上安裝MySQL數(shù)據(jù)庫的步驟:
1.打開終端并切換到root用戶。
2.使用以下命令更新CentOS6系統(tǒng):yum update
3.使用以下命令將MySQL服務(wù)器和客戶端軟件包下載到CentOS6系統(tǒng):
yum install mysql-server mysql
4.使用以下命令啟動(dòng)MySQL服務(wù)器:
service mysqld start
5.使用以下命令將MySQL服務(wù)器設(shè)置為在系統(tǒng)啟動(dòng)時(shí)自動(dòng)啟動(dòng):
chkconfig mysqld on
6.使用以下命令安裝MySQL安全性腳本:
mysql_secure_installation
7.根據(jù)提示依次輸入MySQL管理員密碼和其他設(shè)置。
8.完成后,你可以進(jìn)入MySQL數(shù)據(jù)庫并開始使用它。
PostgreSQL數(shù)據(jù)庫的安裝
PostgreSQL數(shù)據(jù)庫是一個(gè)強(qiáng)大的、開源的關(guān)系型數(shù)據(jù)庫。它擁有高度的可擴(kuò)展性和完備性,使其成為企業(yè)級應(yīng)用程序的首選數(shù)據(jù)庫。以下是在CentOS6上安裝PostgreSQL數(shù)據(jù)庫的步驟:
1.打開終端并切換到root用戶。
2.使用以下命令更新CentOS6系統(tǒng):yum update
3.使用以下命令安裝PostgreSQL:
yum install postgresql-server postgresql-contrib
4.使用以下命令初始化數(shù)據(jù)庫并啟動(dòng)PostgreSQL服務(wù)器:
service postgresql initdb
service postgresql start
5.使用以下命令將PostgreSQL服務(wù)器設(shè)置為在系統(tǒng)啟動(dòng)時(shí)自動(dòng)啟動(dòng):
chkconfig postgresql on
6.使用以下命令更改新用戶的postgres用戶密碼:
passwd postgres
7.使用以下命令登錄PostgreSQL:
su – postgres
psql
8.登錄后,你可以創(chuàng)建自己的數(shù)據(jù)庫和表,或者使用現(xiàn)有的數(shù)據(jù)庫和表。
在CentOS6上安裝數(shù)據(jù)庫需要根據(jù)你的需求選擇適合你的數(shù)據(jù)庫。MySQL和PostgreSQL是兩種常用的免費(fèi)、開源的數(shù)據(jù)庫,本文介紹了在CentOS6上安裝MySQL和PostgreSQL的詳細(xì)步驟。安裝數(shù)據(jù)庫之前,你需要更新你的CentOS6系統(tǒng)。安裝數(shù)據(jù)庫之后,你可以開始創(chuàng)建自己的數(shù)據(jù)庫和表,并開始使用它。
相關(guān)問題拓展閱讀:
- centos6.5安裝mysql cluster問題求助
- centos6.6沒有找到phpmyadmin怎么安裝
centos6.5安裝mysql cluster問題求助
mysql ndbcluster 安裝
1.數(shù)據(jù)庫規(guī)劃:
操作系統(tǒng) centos 6.3
ndbcluster 版本:MySQL-Cluster-gpl-7.4.8-1.el6.x86_64
2個(gè)管理節(jié)點(diǎn)、2個(gè)sql節(jié)點(diǎn)、2個(gè)數(shù)據(jù)節(jié)點(diǎn)(管理節(jié)點(diǎn)和sql節(jié)點(diǎn)放在同一臺(tái)服務(wù)器上)
如下:
管理節(jié)點(diǎn)1 192.168.1.17
管理節(jié)點(diǎn)2 192.168.1.18
sql節(jié)點(diǎn)1 192.168.1.17
sql節(jié)點(diǎn)2 192.168.1.18
ndbd 節(jié)點(diǎn)1 192.168.1.19
ndbd 節(jié)點(diǎn)2 192.168.1.20
2.操雀橋作系統(tǒng)纖渣設(shè)置:
設(shè)置服務(wù)主機(jī)名稱
關(guān)閉selinux和防火墻
設(shè)置內(nèi)核參數(shù)和更大進(jìn)程數(shù)
下載mysql集群
MySQL-Cluster-gpl-7.4.8-1.el6.x86_64.rpm-bundle.tar
上傳到服務(wù)器的相應(yīng)目錄下如 /home/mysqlinstall
3.安裝管理節(jié)點(diǎn)和sql節(jié)點(diǎn):
To check if your system has any RPM version of any MySQL package currently installed, run:
shell> rpm -qa | grep -i mysql
檢查
# rpm -qa | grep -i mysql
mysql-libs-5.1.61-4.el6.x86_64
如果有刪除
shell> rpm -e mysql-libs-5.1.61-4.el6.x86_64
刪除報(bào)錯(cuò):
# rpm -e mysql-libs-5.1.61-4.el6.x86_64
error: Failed dependencies:
libmysqlclient.so.16()(64bit) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
mysql-libs is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
#
解決:
# rpm -e –nodeps mysql-libs-5.1.61-4.el6.x86_64
#
# rpm -ivh MySQL-Cluster-server-gpl-7.4.8-1.el6.x86_64.rpm
# rpm -ivh MySQL-Cluster-server-gpl-7.4.8-1.el6.x86_64.rpm
4.安裝數(shù)據(jù)節(jié)點(diǎn):
執(zhí)行上面步驟
# rpm -ivh MySQL-Cluster-server-gpl-7.4.8-1.el6.x86_64.rpm
# rpm -ivh MySQL-Cluster-server-gpl-7.4.8-1.el6.x86_64.rpm
5.配置集群
管理節(jié)點(diǎn)建立目錄
mkdir /var/lib/mysql-cluster
mkdir -p /data/mysql/ndbdata
5.啟動(dòng)關(guān)閉集群:
啟動(dòng)管理節(jié)點(diǎn)
ndb_mgmd -f /var/lib/mysql-cluster/config.ini –initial (之一次啟動(dòng)加–initial修改了配置文件后的啟動(dòng))
啟動(dòng)數(shù)據(jù)節(jié)點(diǎn)
ndbmtd –initial
啟動(dòng)sql節(jié)點(diǎn)
service mysql start
查看集群狀態(tài)
shell> ndb_mgm -e “SHOW”
關(guān)閉管理節(jié)點(diǎn)和數(shù)據(jù)節(jié)點(diǎn)
ndb_mgm -e shutdown
關(guān)閉sql節(jié)點(diǎn)
service mysql stop
安裝遇到的問題:
1.權(quán)限問題啟動(dòng)mysql報(bào)毀歲悄錯(cuò)
# service mysql start
Starting MySQL..The server quit without updating PID file (sql/sqlmgm2.pid).
#
# ll
total
-rw-rwmysql mysqlDec 14 17:13 auto.cnf
-rw-rwmysql mysqlDec 14 17:39 ibdata1
-rw-rwmysql mysqlDec 14 17:40 ib_logfile0
-rw-rwmysql mysqlDec 14 17:13 ib_logfile1
drwxmysql mysqlDec 14 17:39 mysql
drwxroot rootDec 14 17:39 ndbinfo
drwxroot rootDec 14 17:39 performance_schema
-rw-rmysql mysqlDec 14 17:40 sqlmgm2.err
drwxroot rootDec 14 17:33 test
# chown mysql:mysql -R mysql
# service mysql start
Starting MySQL..
#
2.安裝rpm包時(shí),報(bào)包依賴關(guān)系如下:
# rpm -ivh MySQL-Cluster-server-gpl-7.4.8-1.el6.x86_64.rpm
warning: MySQL-Cluster-server-gpl-7.4.8-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
libnuma.so.1()(64bit) is needed by MySQL-Cluster-server-gpl-7.4.8-1.el6.x86_64
libnuma.so.1(libnuma_1.1)(64bit) is needed by MySQL-Cluster-server-gpl-7.4.8-1.el6.x86_64
libnuma.so.1(libnuma_1.2)(64bit) is needed by MySQL-Cluster-server-gpl-7.4.8-1.el6.x86_
解決方法是把安裝的依賴的包
# yum install numactl
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.opencas.cn
* updates: mirrors.opencas.cn
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package numactl.x86_64 0:2.0.9-2.el6 will be installed
–> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================================================
PackageArchVersion Repository Size
==============================================================================================================================
Installing:
numactlx86_.0.9-2.elbasek
Transaction Summary
==============================================================================================================================
InstallPackage(s)
Total download size: 74 k
Installed size: 171 k
Is this ok : y
Downloading Packages:
numactl-2.0.9-2.el6.x86_64.rpm | 74 kB:
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Retrieving key from
Importing GPG key 0xC105B9DE:
Userid : CentOS-6 Key (CentOS 6 Official Signing Key)
Package: centos-release-6-3.el6.centos.9.x86_64 (@anaconda-CentOS.x86_64/6.3)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Is this ok : y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : numactl-2.0.9-2.el6.x86_/1
Verifying : numactl-2.0.9-2.el6.x86_/1
Installed:
numactl.x86_64 0:2.0.9-2.el
Complete!
3.啟動(dòng)數(shù)據(jù)庫節(jié)點(diǎn)無法和管理節(jié)點(diǎn)相連
原因由于防火墻和selinux沒有關(guān)閉
解決關(guān)閉防火墻和selinux
一、關(guān)閉防火墻
1、重啟后永久性生效:
開啟:chkconfig iptables on
關(guān)閉:chkconfig iptables off
2、即時(shí)生效,重啟后失效:
開啟:service iptables start
關(guān)閉:service iptables stop
二、關(guān)閉SELinux
vim /etc/selinux/config # 改為 SELINUX=disabled
# 保存退出,重啟服務(wù)器
init 6
禁用SeLinux
#永久禁用,需要重啟生效。
sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/g’ /etc/selinux/config
# 臨時(shí)禁用,不需要重啟
setenforce 0
4.root用戶不能登錄
# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)
# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
設(shè)置–skip-grant-tables跳過授權(quán)表認(rèn)證
service mysqld stop
在配置文件中添加–skip-grant-tables(/etc/my.cnf)
service mysqld start
另外開個(gè)SSH連接
# mysql
mysql>use mysql
mysql>update user set password=password(“123456″) where user=”root”;
mysql>flush privileges;
mysql>exit
去掉–skip-grant-tables重啟mysql,root用戶可以用設(shè)置的密碼登錄
設(shè)置root用戶遠(yuǎn)程登錄
GRANT ALL PRIVILEGES ON *.* TO root@’%’ IDENTIFIED BY ‘123456’ WITH GRANT OPTION;
執(zhí)行報(bào)如下錯(cuò)誤,ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.27-ndb-7.4.8-cluster-gpl
Copyright (c) 2023, 2023, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql>
mysql>
mysql> GRANT ALL PRIVILEGES ON *.* TO root@”%” IDENTIFIED BY ‘root’ WITH GRANT OPTION;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
mysql> GRANT ALL PRIVILEGES ON *.* TO root@”%” IDENTIFIED BY ‘root001’ WITH GRANT OPTION;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
執(zhí)行SET PASSWORD修改成功
mysql> SET PASSWORD = PASSWORD(‘root001’);
Query OK, 0 rows affected (0.02 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO root@”%” IDENTIFIED BY ‘root’ WITH GRANT OPTION;
Query OK, 0 rows affected (0.02 sec)
mysql>
FLUSH PRIVILEGES;
執(zhí)行完成
遠(yuǎn)程連接測試,mysql集群節(jié)點(diǎn),發(fā)現(xiàn)一個(gè)節(jié)點(diǎn)可以連接,一個(gè)節(jié)點(diǎn)不能連接
這個(gè)問題糾結(jié)很久
原因上面的操作,沒有在另外一個(gè)節(jié)點(diǎn)上執(zhí)行導(dǎo)致的,mysql集群的用戶認(rèn)證是分開管理的,要兩個(gè)節(jié)點(diǎn)都要執(zhí)行
索引以后創(chuàng)建用戶要兩個(gè)節(jié)點(diǎn)都執(zhí)行
5.配置兩個(gè)管理節(jié)點(diǎn)時(shí)show報(bào)錯(cuò)Could not get configuration
# ndb_mgm
— NDB Cluster — Management Client —
ndb_mgm> show
Connected to Management Server at: 192.168.1.17:1186
ERROR Message: The cluster configuration is not yet confirmed by all defined management servers. This management server is still waiting for node 6 to connect.
Could not get configuration
* 4012: Failed to get configuration
*The cluster configuration is not yet confirmed by all defined management servers. This management server is still waiting for node 6 to connect.
ndb_mgm> show
Cluster Configuration
node(s)
id=2 (not connected, accepting connect from 192.168.1.18)
id=3 (not connected, accepting connect from 192.168.1.17)
2 node(s)
id=1 @192.168.1.17 (mysql-5.6.27 ndb-7.4.8)
id=6 @192.168.1.18 (mysql-5.6.27 ndb-7.4.8)
2 node(s)
id=4 (not connected, accepting connect from 192.168.1.17)
id=5 (not connected, accepting connect from 192.168.1.18)
兩個(gè)管理節(jié)點(diǎn)同時(shí)都啟動(dòng)起來,才能看到狀態(tài)
ndb_mgm> show
Cluster Configuration
node(s)
id=2 @192.168.1.18 (mysql-5.6.27 ndb-7.4.8, Nodegroup: 0, *)
id=3 @192.168.1.17 (mysql-5.6.27 ndb-7.4.8, Nodegroup: 0)
2 node(s)
id=1 @192.168.1.17 (mysql-5.6.27 ndb-7.4.8)
id=6 @192.168.1.18 (mysql-5.6.27 ndb-7.4.8)
2 node(s)
id=4 @192.168.1.17 (mysql-5.6.27 ndb-7.4.8)
centos6.6沒有找到phpmyadmin怎么安裝
安裝好PHP,Apache和MySQL程序后,為了管理MySQL數(shù)據(jù)庫,我們需要安裝豎拿phpMyAdmin程序。下面是關(guān)于如何在友纖滲centos安裝phpMyAdmin程序的方法。1、管理員root身份登錄系統(tǒng)2、進(jìn)入網(wǎng)站根目錄(如/var/www/html)cd /var/www/html3、下載最新版本的phpMyAdmin程序4、解壓程序壓縮包tar xvfz phpMyAdmin-3.3.10-all-languages.tar.gz5、移動(dòng)目錄phpMyAdmin-3.3.10-all-languages到phpmyadmin文件夾mv phpMyAdmin-3.3.10-all-languages phpmyadmin6、進(jìn)入phpmyadmin目錄cd phpmyadmin7、復(fù)制樣本配置文件到config.inc.php文件cp config.sample.inc.php config.inc.php8、編好脊輯配置文件并按以下修改vi config.inc.php修改后的代碼::$cfg = ‘http‘; # default is cookies:9、重啟apacheservice httpd restart關(guān)于centos6數(shù)據(jù)庫安裝的介紹到此就結(jié)束了,不知道你從中找到你需要的信息了嗎 ?如果你還想了解更多這方面的信息,記得收藏關(guān)注本站。
成都創(chuàng)新互聯(lián)科技有限公司,是一家專注于互聯(lián)網(wǎng)、IDC服務(wù)、應(yīng)用軟件開發(fā)、網(wǎng)站建設(shè)推廣的公司,為客戶提供互聯(lián)網(wǎng)基礎(chǔ)服務(wù)!
創(chuàng)新互聯(lián)(www.cdcxhl.com)提供簡單好用,價(jià)格厚道的香港/美國云服務(wù)器和獨(dú)立服務(wù)器。創(chuàng)新互聯(lián)成都老牌IDC服務(wù)商,專注四川成都IDC機(jī)房服務(wù)器托管/機(jī)柜租用。為您精選優(yōu)質(zhì)idc數(shù)據(jù)中心機(jī)房租用、服務(wù)器托管、機(jī)柜租賃、大帶寬租用,可選線路電信、移動(dòng)、聯(lián)通等。
網(wǎng)頁題目:CentOS6上安裝數(shù)據(jù)庫的方法(centos6數(shù)據(jù)庫安裝)
新聞來源:http://m.fisionsoft.com.cn/article/cccssop.html


咨詢
建站咨詢
