-安裝前準(zhǔn)備
-安裝mysql
-配置mysql
安裝前準(zhǔn)備:
查看系統(tǒng)版本
[root@localhost ~]# cat /etc/redhat-release #查看系統(tǒng)版本
Red Hat Enterprise Linux Server release 7.0 (Maipo)
在安裝mysql時(shí)需把其它數(shù)據(jù)庫(kù)刪除攀操,以免沖突
[root@localhost ~]# rpm -qa | grep mariadb-libs* #查看是否有此包
[root@localhost ~]# rpm -e --nodeps mariadb-libs* #如果此數(shù)據(jù)庫(kù)已安裝則刪除
安裝mysql數(shù)據(jù)庫(kù)依賴包(也可以先跳過(guò)該步,看后面安裝mysql時(shí)缺少什么依賴就安裝什么依賴)
[root@localhost APP]# yum -y install ncurses ncurses-devel openssl-devel bison gcc gcc-c++ make perl net-tools numactl #安裝mysql 依賴包
創(chuàng)建相關(guān)目錄及用戶等
[root@localhost ~]# mkdir /APP #創(chuàng)建放置安裝包的文件夾
[root@localhost /]# groupadd mysql
[root@localhost /]# useradd -g mysql mysql
[root@localhost /]# chown -R mysql:mysql /APP/
[root@localhost /]# passwd mysql
[root@localhost /]# cat /etc/group | grep mysql
mysql:x:1001:
[root@localhost /]# cat /etc/passwd | grep mysql
mysql:x:1001:1001::/home/mysql:/bin/bash
image.png
image.png
下載mysql數(shù)據(jù)庫(kù):
[https://dev.mysql.com/downloads/mysql/]
打開(kāi)mysql官網(wǎng):
image.png
點(diǎn)擊社區(qū)版本進(jìn)行下載
image.png
點(diǎn)擊社區(qū)版本進(jìn)行下載
image.png
選擇合適的系統(tǒng)和版本
image.png
選擇系統(tǒng)和下載的安裝包
image.png
點(diǎn)擊下載
image.png
下載完畢把下載的安裝包放置新創(chuàng)建/APP/mysql目錄中
image.png
[root@localhost /]# cd /APP/mysql/
[root@localhost mysql]# ls
mysql-8.0.31-1.el7.x86_64.rpm-bundle.tar
[root@localhost mysql]# ll
-rw-r--r-- 1 mysql mysql 906106880 Nov 2 02:03 mysql-8.0.31-1.el7.x86_64.rpm-bundle.tar
[root@localhost mysql]# tar xvf mysql-8.0.31-1.el7.x86_64.rpm-bundle.tar
[root@localhost mysql]# ls
image.png
安裝之前我們需要安裝依賴 openssl-libs-1.0.2k-16.el7_6.1.x86_64.rpm 包
下載地址 http://rpm.pbone.net/
image.png
image.png
image.png
image.png
image.png
上傳到linux服務(wù)器上解壓進(jìn)行安裝
[root@localhost mysql]# rpm -ivh openssl-libs-1.0.2k-16.el7_6.1.x86_64.rpm --force #忽略依賴安裝
安裝所需的安裝包(解壓之后的其中四個(gè)包)安裝步驟一步一步來(lái)碎罚,亂一步都不可以棒拂,否則卸載相應(yīng)從裝。
[root@localhost mysql]# rpm -ivh mysql-community-common-8.0.31-1.el7.x86_64.rpm
[root@localhost mysql]# rpm -ivh mysql-community-client-plugins-8.0.31-1.el7.x86_64.rpm
[root@localhost mysql]# rpm -ivh mysql-community-libs-8.0.31-1.el7.x86_64.rpm
[root@localhost mysql]# rpm -ivh mysql-community-client-8.0.31-1.el7.x86_64.rpm
[root@localhost mysql]# rpm -ivh mysql-community-server-8.0.31-1.el7.x86_64.rpm
[root@localhost mysql]# systemctl start mysql #啟動(dòng)mysql服務(wù)器
[root@localhost ~]# cat /var/log/mysqld.log | grep password #查看第一次啟動(dòng)時(shí)mysql自動(dòng)生成的密碼
2022-11-02T13:00:34.273033Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: mbKEBs
h?8,zJ
image.png
[root@localhost ~]# mysql -u root -p #輸入初始密碼
image.png