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

公司主營業(yè)務:成都網站制作、成都做網站、移動網站開發(fā)等業(yè)務。幫助企業(yè)客戶真正實現互聯網宣傳,提高企業(yè)的競爭能力。成都創(chuàng)新互聯是一支青春激揚、勤奮敬業(yè)、活力青春激揚、勤奮敬業(yè)、活力澎湃、和諧高效的團隊。公司秉承以“開放、自由、嚴謹、自律”為核心的企業(yè)文化,感謝他們對我們的高要求,感謝他們從不同領域給我們帶來的挑戰(zhàn),讓我們激情的團隊有機會用頭腦與智慧不斷的給客戶帶來驚喜。成都創(chuàng)新互聯推出孟津免費做網站回饋大家。
選擇適合你的數據庫
在將數據庫安裝到CentOS6系統(tǒng)之前,你需要選擇一種適合你的數據庫。目前大多數企業(yè)和組織都選擇MySQL或PostgreSQL數據庫,因為它們是免費的、開源的和易于使用的數據庫。其他的數據庫包括Oracle、MongoDB和SQL Server。你需要根據你的需求選擇適合你的數據庫。
MySQL數據庫的安裝
MySQL數據庫是一個流行的、開源的關系型數據庫管理系統(tǒng)。它支持多用戶、多線程,并且能夠處理大量的數據。以下是在CentOS6上安裝MySQL數據庫的步驟:
1.打開終端并切換到root用戶。
2.使用以下命令更新CentOS6系統(tǒng):yum update
3.使用以下命令將MySQL服務器和客戶端軟件包下載到CentOS6系統(tǒng):
yum install mysql-server mysql
4.使用以下命令啟動MySQL服務器:
service mysqld start
5.使用以下命令將MySQL服務器設置為在系統(tǒng)啟動時自動啟動:
chkconfig mysqld on
6.使用以下命令安裝MySQL安全性腳本:
mysql_secure_installation
7.根據提示依次輸入MySQL管理員密碼和其他設置。
8.完成后,你可以進入MySQL數據庫并開始使用它。
PostgreSQL數據庫的安裝
PostgreSQL數據庫是一個強大的、開源的關系型數據庫。它擁有高度的可擴展性和完備性,使其成為企業(yè)級應用程序的首選數據庫。以下是在CentOS6上安裝PostgreSQL數據庫的步驟:
1.打開終端并切換到root用戶。
2.使用以下命令更新CentOS6系統(tǒng):yum update
3.使用以下命令安裝PostgreSQL:
yum install postgresql-server postgresql-contrib
4.使用以下命令初始化數據庫并啟動PostgreSQL服務器:
service postgresql initdb
service postgresql start
5.使用以下命令將PostgreSQL服務器設置為在系統(tǒng)啟動時自動啟動:
chkconfig postgresql on
6.使用以下命令更改新用戶的postgres用戶密碼:
passwd postgres
7.使用以下命令登錄PostgreSQL:
su – postgres
psql
8.登錄后,你可以創(chuàng)建自己的數據庫和表,或者使用現有的數據庫和表。
在CentOS6上安裝數據庫需要根據你的需求選擇適合你的數據庫。MySQL和PostgreSQL是兩種常用的免費、開源的數據庫,本文介紹了在CentOS6上安裝MySQL和PostgreSQL的詳細步驟。安裝數據庫之前,你需要更新你的CentOS6系統(tǒng)。安裝數據庫之后,你可以開始創(chuàng)建自己的數據庫和表,并開始使用它。
相關問題拓展閱讀:
- centos6.5安裝mysql cluster問題求助
- centos6.6沒有找到phpmyadmin怎么安裝
centos6.5安裝mysql cluster問題求助
mysql ndbcluster 安裝
1.數據庫規(guī)劃:
操作系統(tǒng) centos 6.3
ndbcluster 版本:MySQL-Cluster-gpl-7.4.8-1.el6.x86_64
2個管理節(jié)點、2個sql節(jié)點、2個數據節(jié)點(管理節(jié)點和sql節(jié)點放在同一臺服務器上)
如下:
管理節(jié)點1 192.168.1.17
管理節(jié)點2 192.168.1.18
sql節(jié)點1 192.168.1.17
sql節(jié)點2 192.168.1.18
ndbd 節(jié)點1 192.168.1.19
ndbd 節(jié)點2 192.168.1.20
2.操雀橋作系統(tǒng)纖渣設置:
設置服務主機名稱
關閉selinux和防火墻
設置內核參數和更大進程數
下載mysql集群
MySQL-Cluster-gpl-7.4.8-1.el6.x86_64.rpm-bundle.tar
上傳到服務器的相應目錄下如 /home/mysqlinstall
3.安裝管理節(jié)點和sql節(jié)點:
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
刪除報錯:
# 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.安裝數據節(jié)點:
執(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é)點建立目錄
mkdir /var/lib/mysql-cluster
mkdir -p /data/mysql/ndbdata
5.啟動關閉集群:
啟動管理節(jié)點
ndb_mgmd -f /var/lib/mysql-cluster/config.ini –initial (之一次啟動加–initial修改了配置文件后的啟動)
啟動數據節(jié)點
ndbmtd –initial
啟動sql節(jié)點
service mysql start
查看集群狀態(tài)
shell> ndb_mgm -e “SHOW”
關閉管理節(jié)點和數據節(jié)點
ndb_mgm -e shutdown
關閉sql節(jié)點
service mysql stop
安裝遇到的問題:
1.權限問題啟動mysql報毀歲悄錯
# 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包時,報包依賴關系如下:
# 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.啟動數據庫節(jié)點無法和管理節(jié)點相連
原因由于防火墻和selinux沒有關閉
解決關閉防火墻和selinux
一、關閉防火墻
1、重啟后永久性生效:
開啟:chkconfig iptables on
關閉:chkconfig iptables off
2、即時生效,重啟后失效:
開啟:service iptables start
關閉:service iptables stop
二、關閉SELinux
vim /etc/selinux/config # 改為 SELINUX=disabled
# 保存退出,重啟服務器
init 6
禁用SeLinux
#永久禁用,需要重啟生效。
sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/g’ /etc/selinux/config
# 臨時禁用,不需要重啟
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)
設置–skip-grant-tables跳過授權表認證
service mysqld stop
在配置文件中添加–skip-grant-tables(/etc/my.cnf)
service mysqld start
另外開個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用戶可以用設置的密碼登錄
設置root用戶遠程登錄
GRANT ALL PRIVILEGES ON *.* TO root@’%’ IDENTIFIED BY ‘123456’ WITH GRANT OPTION;
執(zhí)行報如下錯誤,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í)行完成
遠程連接測試,mysql集群節(jié)點,發(fā)現一個節(jié)點可以連接,一個節(jié)點不能連接
這個問題糾結很久
原因上面的操作,沒有在另外一個節(jié)點上執(zhí)行導致的,mysql集群的用戶認證是分開管理的,要兩個節(jié)點都要執(zhí)行
索引以后創(chuàng)建用戶要兩個節(jié)點都執(zhí)行
5.配置兩個管理節(jié)點時show報錯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)
兩個管理節(jié)點同時都啟動起來,才能看到狀態(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數據庫,我們需要安裝豎拿phpMyAdmin程序。下面是關于如何在友纖滲centos安裝phpMyAdmin程序的方法。1、管理員root身份登錄系統(tǒng)2、進入網站根目錄(如/var/www/html)cd /var/www/html3、下載最新版本的phpMyAdmin程序4、解壓程序壓縮包tar xvfz phpMyAdmin-3.3.10-all-languages.tar.gz5、移動目錄phpMyAdmin-3.3.10-all-languages到phpmyadmin文件夾mv phpMyAdmin-3.3.10-all-languages phpmyadmin6、進入phpmyadmin目錄cd phpmyadmin7、復制樣本配置文件到config.inc.php文件cp config.sample.inc.php config.inc.php8、編好脊輯配置文件并按以下修改vi config.inc.php修改后的代碼::$cfg = ‘http‘; # default is cookies:9、重啟apacheservice httpd restart關于centos6數據庫安裝的介紹到此就結束了,不知道你從中找到你需要的信息了嗎 ?如果你還想了解更多這方面的信息,記得收藏關注本站。
成都創(chuàng)新互聯科技有限公司,是一家專注于互聯網、IDC服務、應用軟件開發(fā)、網站建設推廣的公司,為客戶提供互聯網基礎服務!
創(chuàng)新互聯(www.cdcxhl.com)提供簡單好用,價格厚道的香港/美國云服務器和獨立服務器。創(chuàng)新互聯成都老牌IDC服務商,專注四川成都IDC機房服務器托管/機柜租用。為您精選優(yōu)質idc數據中心機房租用、服務器托管、機柜租賃、大帶寬租用,可選線路電信、移動、聯通等。
網站名稱:CentOS6上安裝數據庫的方法(centos6數據庫安裝)
文章URL:http://www.5511xx.com/article/cccssop.html


咨詢
建站咨詢
