由于项目需要,需要在rh7.4上安装mysql版本,之前6.8的环境直接挂载iso yum源安装,rh7以上的版本只有手工安装了
1.安装前准备
到mysql官网下载相应的rpm包
下载地址:https://dev.mysql.com/downloads/mysql/5.7.html#downloads
选择自己需要的版本
官网下载速度较慢,有需要的可以到我的共享下载
2.通过scp上传至需要安装的服务器并解压
tar -xvf mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar -C /opt/
解压后文件
mysql-community-embedded-devel-5.7.26-1.el7.x86_64.rpm
mysql-community-libs-5.7.26-1.el7.x86_64.rpm
mysql-community-embedded-5.7.26-1.el7.x86_64.rpm
mysql-community-test-5.7.26-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.26-1.el7.x86_64.rpm
mysql-community-common-5.7.26-1.el7.x86_64.rpm
mysql-community-devel-5.7.26-1.el7.x86_64.rpm
mysql-community-client-5.7.26-1.el7.x86_64.rpm
mysql-community-server-5.7.26-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.26-1.el7.x86_64.rpm
3.考虑到安装包依赖关系,通过rpm按照顺序安装
rpm -ivh mysql-community-common-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.26-1.el7.x86_64.rpm
4.启动并查看mysql状态
systemctl start mysqld.service
systemctl status mysqld.service
5.通过/var/log/mysqld.log查找mysql密码并登陆
[root@hadoop-2 log]# grep "pass" mysqld.log
2019-06-19T00:59:58.620256Z 1 [Note] A temporary password is generated for root@localhost: Ve9vP<vp3CiU
2019-06-19T01:00:20.364725Z 2 [Note] Access denied for user 'root'@'localhost' (using password: NO)
[root@hadoop-2 opt]# mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Abcde2008!';
网友评论