您好,登錄后才能下訂單哦!
本篇文章為大家展示了服務(wù)器Centos 7中怎么安裝mysql8.0.16,內(nèi)容簡(jiǎn)明扼要并且容易理解,絕對(duì)能使你眼前一亮,通過(guò)這篇文章的詳細(xì)介紹希望你能有所收獲。
1. Select Operating System: 選擇 Red Hat ,CentOS 是基于紅帽的,Select OS Version: 選擇 linux 7
2. 選擇 RPM Bundle 點(diǎn)擊 Download
tar -xvf mysql-8.0.16-2.el7.x86_64.rpm-bundle.tar
mysql-8.0.16-2.el7.x86_64.rpm-bundle.tar解壓后有如下8個(gè)文件:
-rw-r--r-- 1 7155 31415 33432660 May 3 12:38 mysql-community-client-8.0.16-2.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 588520 May 3 12:38 mysql-community-common-8.0.16-2.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 5712552 May 3 12:38 mysql-community-devel-8.0.16-2.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 24493344 May 3 12:38 mysql-community-embedded-compat-8.0.16-2.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 3127296 May 3 12:38 mysql-community-libs-8.0.16-2.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 2177156 May 3 12:38 mysql-community-libs-compat-8.0.16-2.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 422672748 May 3 12:39 mysql-community-server-8.0.16-2.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 114848996 May 3 12:40 mysql-community-test-8.0.16-2.el7.x86_64.rpm
建議裝之前先把之前的mysql相關(guān)包全部卸載,rpm -e --nodeps <包名>即可
按如下順序依次安裝:
rpm -ivh mysql-community-common-8.0.16-2.el7.x86_64.rpm
warning: mysql-community-libs-8.0.16-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-libs-8.0.16-2.el7################################# [100%]
rpm -ivh mysql-community-libs-8.0.16-2.el7.x86_64.rpm
warning: mysql-community-libs-8.0.16-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-libs-8.0.16-2.el7################################# [100%]
rpm -ivh mysql-community-libs-compat-8.0.16-2.el7.x86_64.rpm
warning: mysql-community-libs-compat-8.0.16-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-libs-compat-8.0.1################################# [100%]
rpm -ivh mysql-community-client-8.0.16-2.el7.x86_64.rpm
warning: mysql-community-client-8.0.16-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-client-8.0.16-2.e################################# [100%]
rpm -ivh mysql-community-server-8.0.16-2.el7.x86_64.rpm
warning: mysql-community-server-8.0.16-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-server-8.0.16-2.e################################# [100%]
yum install -y openssl-devel.x86_64 openssl.x86_64
Installed:
openssl-devel.x86_64 1:1.0.2k-16.el7_6.1
Dependency Installed:
keyutils-libs-devel.x86_64 0:1.5.8-3.el7 krb5-devel.x86_64 0:1.15.1-37.el7_6 libcom_err-devel.x86_64 0:1.42.9-13.el7 libkadm5.x86_64 0:1.15.1-37.el7_6 libselinux-devel.x86_64 0:2.5-14.1.el7
libsepol-devel.x86_64 0:2.5-10.el7
rpm -ivh mysql-community-devel-8.0.16-2.el7.x86_64.rpm
warning: mysql-community-devel-8.0.16-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-devel-8.0.16-2.el################################# [100%]
yum install -y perl.x86_64 perl-devel.x86_64
Installed:
perl-devel.x86_64 4:5.16.3-294.el7_6
Dependency Installed:
gdbm-devel.x86_64 0:1.10-8.el7 libdb-devel.x86_64 0:5.3.21-24.el7 perl-ExtUtils-Install.noarch 0:1.58-294.el7_6 perl-ExtUtils-MakeMaker.noarch 0:6.68-3.el7
perl-ExtUtils-Manifest.noarch 0:1.61-244.el7 perl-ExtUtils-ParseXS.noarch 1:3.18-3.el7 perl-Test-Harness.noarch 0:3.28-3.el7 pyparsing.noarch 0:1.5.6-9.el7
systemtap-sdt-devel.x86_64 0:3.3-3.el7
Complete!
yum install -y perl-JSON.noarch
Installed:
perl-JSON.noarch 0:2.59-2.el7
Complete!
yum -y install autoconf
Installed:
autoconf.noarch 0:2.69-11.el7
Dependency Installed:
perl-Data-Dumper.x86_64 0:2.145-3.el7
Complete!
rpm -ivh mysql-community-test-8.0.16-2.el7.x86_64.rpm
warning: mysql-community-test-8.0.16-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-test-8.0.16-2.el7################################# [100%]
mysql -V
顯示如下信息說(shuō)明安裝成功
mysql Ver 8.0.16 for Linux on x86_64 (MySQL Community Server - GPL)
ll /etc/my.cnf
-rw-r--r-- 1 root root 1243 May 3 05:11 /etc/my.cnf
vim /etc/my.cnf
添加如下信息:
#配置MYSQL大小寫(xiě)敏感(1-不敏感,0-敏感) lower_case_table_names=1
注意!MySQL8.0想要 大小寫(xiě)不敏感,必須在安裝好MySQL后未啟動(dòng)之前 修改MySQL配置文件設(shè)置為不敏感,一旦啟動(dòng)后,再設(shè)置是無(wú)效的,而且啟動(dòng)會(huì)報(bào)錯(cuò)。
如果已經(jīng)晚了,那必須把MySQL數(shù)據(jù)庫(kù)文件全部 刪除,修改配置文件再啟動(dòng)。
如果數(shù)據(jù)不重要,可以先關(guān)閉服務(wù)刪掉數(shù)據(jù),再執(zhí)行以上操作:
service mysqld stop rm -rf /var/lib/mysql
mysqld --initialize --console
chown -R mysql:mysql /var/lib/mysql/
systemctl start mysqld
備注:
停止命令:service mysqld stop
service mysqld status
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2019-07-15 20:24:51 CST; 1min 18s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 13374 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 13397 (mysqld)
Status: "SERVER_OPERATING"
CGroup: /system.slice/mysqld.service
└─13397 /usr/sbin/mysqld
Jul 15 20:24:49 iZbp109fnkszgzwbnmaoe1Z systemd[1]: Starting MySQL Server...
Jul 15 20:24:51 iZbp109fnkszgzwbnmaoe1Z systemd[1]: Started MySQL Server.
cat /var/log/mysqld.log
2019-07-15T12:23:06.493163Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.16) initializing of server in progress as process 13286
2019-07-15T12:23:10.070584Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: dK3rw_EM_mjs
2019-07-15T12:23:11.237915Z 0 [System] [MY-013170] [Server] /usr/sbin/mysqld (mysqld 8.0.16) initializing of server has completed
2019-07-15T12:24:05.782446Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.16) starting as process 13361
2019-07-15T12:24:05.793657Z 1 [ERROR] [MY-012271] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2019-07-15T12:24:05.793678Z 1 [ERROR] [MY-012278] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2019-07-15T12:24:05.793704Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2019-07-15T12:24:05.793814Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2019-07-15T12:24:05.793897Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-07-15T12:24:05.794672Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.16) MySQL Community Server - GPL.
2019-07-15T12:24:50.367615Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.16) starting as process 13397
2019-07-15T12:24:50.979080Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2019-07-15T12:24:51.199081Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.16' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server - GPL.
2019-07-15T12:24:51.265716Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060
mysql -u root -p
+ 回車(chē)鍵
輸入臨時(shí)密碼(輸入時(shí)不會(huì)顯示出來(lái),輸入完直接回車(chē))
alter USER 'root'@'localhost' IDENTIFIED BY '密碼';
密碼:必須包含數(shù)字及大小寫(xiě)字母特殊字符
依次執(zhí)行下列mysql命令 授權(quán)遠(yuǎn)程連接
查看所有用戶是否可以遠(yuǎn)程連接,依次執(zhí)行下列命令:
show databases;
use mysql;
select host, user, authentication_string, plugin from user;
修改root用戶host值,使root用戶可以遠(yuǎn)程登錄
update user set host = "%" where user='root';
刷新
flush privileges;
上述內(nèi)容就是服務(wù)器Centos 7中怎么安裝mysql8.0.16,你們學(xué)到知識(shí)或技能了嗎?如果還想學(xué)到更多技能或者豐富自己的知識(shí)儲(chǔ)備,歡迎關(guān)注億速云行業(yè)資訊頻道。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。