本次安装的是mysql-5.7.27-1.el6.x86_64.rpm-bundle.tar
- 官方下载地址:
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.20-1.el6.x86_64.rpm-bundle.tar
- 解压
tar -xvf mysql-5.7.20-1.el6.x86_64.rpm-bundle.tar
- 卸载之前的版本
rpm -qa | grep -i mysql
rpm -e xxxxx [之前安装的版本] --nodeps 要卸载的mysql版本
- 按照步骤来安装就好
1.rpm -ivh mysql-community-libs-5.7.20-1.el6.x86_64.rpm --nodeps --force
2.rpm -ivh mysql-community-devel-5.7.20-1.el6.x86_64.rpm --nodeps --force
3.rpm -ivh mysql-community-client-5.7.20-1.el6.x86_64.rpm --nodeps --force
4.rpm -ivh mysql-community-server-5.7.20-1.el6.x86_64.rpm --nodeps --force
安装最后一个时出现报错
rpm -ivh mysql-community-server-5.7.19-1.el7.x86_64.rpm
报错:
warning: mysql-community-server-5.7.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
/usr/bin/perl is needed by mysql-community-server-5.7.19-1.el7.x86_64
libaio.so.1()(64bit) is needed by mysql-community-server-5.7.19-1.el7.x86_64
libaio.so.1(LIBAIO_0.1)(64bit) is needed by mysql-community-server-5.7.19-1.el7.x86_64
libaio.so.1(LIBAIO_0.4)(64bit) is needed by mysql-community-server-5.7.19-1.el7.x86_64
net-tools is needed by mysql-community-server-5.7.19-1.el7.x86_64
perl(Getopt::Long) is needed by mysql-community-server-5.7.19-1.el7.x86_64
perl(strict) is needed by mysql-community-server-5.7.19-1.el7.x86_64
缺少net-tools.x86_64,libaio.x86_64,perl.x86_64三个依赖,使用yum安装即可。
yum -y install perl.x86_64
yum install -y libaio.x86_64
yum -y install net-tools.x86_64
接着报错
[root@localhost ~]# rpm -ivh mysql-community-server-5.7.23-1.el6.x86_64.rpm
warning: mysql-community-server-5.7.23-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
libnuma.so.1()(64bit) is needed by mysql-community-server-5.7.23-1.el6.x86_64
libnuma.so.1(libnuma_1.1)(64bit) is needed by mysql-community-server-5.7.23-1.el6.x86_64
libnuma.so.1(libnuma_1.2)(64bit) is needed by mysql-community-server-5.7.23-1.el6.x86_64
mysql-community-client(x86-64) >= 5.7.9 is needed by mysql-community-server-5.7.23-1.el6.x86_64
mysql-community-common(x86-64) = 5.7.23-1.el6 is needed by mysql-community-server-5.7.23-1.el6.x86_64
缺少依赖!!!安装
yum -y install numactl
启动数据库
# 查看mysql是否启动
service mysqld status
# 启动mysql
service mysqld start
# 停止mysql
service mysqld stop
# 重启mysql
service mysqld restart
进入mysql
获取临时密码:
grep 'temporary password' /var/log/mysqld.log
框内第一个为用户名,第二个为临时密码
首先进入mysql
mysql -uroot -p 临时密码
将root的密码改为root
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
开启远程访问:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY 'root' WITH GRANT OPTION;
刷新权限:
flush privileges;