您好,登錄后才能下訂單哦!
本篇文章為大家展示了服務器Centos 7中怎么安裝mysql8.0.16,內容簡明扼要并且容易理解,絕對能使你眼前一亮,通過這篇文章的詳細介紹希望你能有所收獲。
1. Select Operating System: 選擇 Red Hat ,CentOS 是基于紅帽的,Select OS Version: 選擇 linux 7
2. 選擇 RPM Bundle 點擊 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個文件:
-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相關包全部卸載,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
顯示如下信息說明安裝成功
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大小寫敏感(1-不敏感,0-敏感) lower_case_table_names=1
注意!MySQL8.0想要 大小寫不敏感,必須在安裝好MySQL后未啟動之前 修改MySQL配置文件設置為不敏感,一旦啟動后,再設置是無效的,而且啟動會報錯。
如果已經晚了,那必須把MySQL數據庫文件全部 刪除,修改配置文件再啟動。
如果數據不重要,可以先關閉服務刪掉數據,再執行以上操作:
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
+ 回車鍵
輸入臨時密碼(輸入時不會顯示出來,輸入完直接回車)
alter USER 'root'@'localhost' IDENTIFIED BY '密碼';
密碼:必須包含數字及大小寫字母特殊字符
依次執行下列mysql命令 授權遠程連接
查看所有用戶是否可以遠程連接,依次執行下列命令:
show databases;
use mysql;
select host, user, authentication_string, plugin from user;
修改root用戶host值,使root用戶可以遠程登錄
update user set host = "%" where user='root';
刷新
flush privileges;
上述內容就是服務器Centos 7中怎么安裝mysql8.0.16,你們學到知識或技能了嗎?如果還想學到更多技能或者豐富自己的知識儲備,歡迎關注億速云行業資訊頻道。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。