这里介绍的是,采用rpm方式,安装mysql 8.0.17
Software: Mysql 8.0.17
Operate System: Linux x86_64 OpenCloudOs(derive from centos 8/readhat8)
Install Way: Rpm
参考:https://dev.mysql.com/doc/refman/8.0/en/linux-installation-rpm.html
下载rpm文件
manifest 如下:
mysql-community-common: http://repo.mysql.com/yum/mysql-8.0-community/el/8/x86_64/mysql-community-common-8.0.17-1.el8.x86_64.rpm
mysql-community-libs: http://repo.mysql.com/yum/mysql-8.0-community/el/8/x86_64/mysql-community-libs-8.0.17-1.el8.x86_64.rpm
mysql-community-client: http://repo.mysql.com/yum/mysql-8.0-community/el/8/x86_64/mysql-community-client-8.0.17-1.el8.x86_64.rpm
mysql-community-server: http://repo.mysql.com/yum/mysql-8.0-community/el/8/x86_64/mysql-community-server-8.0.17-1.el8.x86_64.rpm
开始安装
接下来,我们将这些文件,按照顺序安装。其中,common 和 libs 是基础包,必须先安装
rpm -ivh mysql-community-common-8.0.17-1.el8.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.17-1.el8.x86_64.rpm
rpm -ivh mysql-community-client-8.0.17-1.el8.x86_64.rpm
rpm -ivh mysql-community-server-8.0.17-1.el8.x86_64.rpm
在安装community-server时,可能会报以下错误:
warning: mysql-community-server-8.0.17-1.el8.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
/usr/bin/perl is needed by mysql-community-server-8.0.17-1.el8.x86_64
libaio.so.1()(64bit) is needed by mysql-community-server-8.0.17-1.el8.x86_64
libaio.so.1(LIBAIO_0.1)(64bit) is needed by mysql-community-server-8.0.17-1.el8.x86_64
libaio.so.1(LIBAIO_0.4)(64bit) is needed by mysql-community-server-8.0.17-1.el8.x86_64
perl(Getopt::Long) is needed by mysql-community-server-8.0.17-1.el8.x86_64
perl(strict) is needed by mysql-community-server-8.0.17-1.el8.x86_64
这个表示,community-server,缺少net-tools.x86_64,libaio.x86_64,perl.x86_64三个依赖
我们这里,使用yum的方式,来安转这3个依赖:
yum install -y perl.x86_64
yum install -y libaio.x86_64
yum install -y net-tools.x86_64
上面3个依赖,安装完成后,我们继续安装community-server即可。
在安装community-server时,可能会报以下错误:
warning: mysql-community-server-8.0.17-1.el8.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
mariadb-connector-c-config is obsoleted by mysql-community-server-8.0.17-1.el8.x86_64
这个表示mysql-community-server,不认可mariadb-connector-c-config,这里采用的解决方案是:
将mariadb-connector-c-config移除即可
yum remove mariadb-connector-c-config -y
启动Mysql 并进行密码初始化设置
systemctl start mysqld
# 查看自动生成的密码
grep 'temporary password' /var/log/mysqld.log
mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPassword!';
# 接下来,让远程客户端,也可以访问mysql server
use mysql;
select host from user where user='root';
update user set host = '%' where user ='root';
flush privileges;
quit
开启firewall port & 测试访问
firewall-cmd --state
systemctl start firewalld.service
firewall-cmd --add-port=3306/tcp --permanent
firewall-cmd --reload
# 接下来,使用mysql-workbench,测试,是否能正常访问mysql-server
在centos7 上安装mysql 8
refer to : https://dev.mysql.com/doc/refman/8.0/en/linux-installation-rpm.html
下载文件
mkdir Mysql
wget http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-client-8.0.27-1.el7.x86_64.rpm
wget http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-server-8.0.27-1.el7.x86_64.rpm
wget http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-common-8.0.27-1.el7.x86_64.rpm
wget http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-libs-8.0.27-1.el7.x86_64.rpm
wget http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-libs-compat-8.0.27-1.el7.x86_64.rpm
wget http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-client-plugins-8.0.27-1.el7.x86_64.rpm
使用yum安装
yum install mysql-community-{server,client,common,libs}-*