1.下载 4个rpm包

mysql-community-client-5.7.26-1.el7.x86_64.rpm
mysql-community-common-5.7.26-1.el7.x86_64.rpm
mysql-community-libs-5.7.26-1.el7.x86_64.rpm
mysql-community-server-5.7.26-1.el7.x86_64.rpm

想要用迅雷进行下载得先找到对应的rpm下载路径

首先浏览器打开mysql官网:https://dev.mysql.com/downloads/mysql/5.7.html#downloads

 

在官网找到对应的版本:

 

右键复制链接地址,粘贴到迅雷即可下载:

 

 

 

如下给出了4个myql5.7 的rpm包的路径,直接打开迅雷填入下载路径就可以进行下载,其他版本可以用同样方法:

 https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-server-5.7.26-1.el7.x86_64.rpm

 https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-client-5.7.26-1.el7.x86_64.rpm

 https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-common-5.7.26-1.el7.x86_64.rpm

 https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-libs-5.7.26-1.el7.x86_64.rpm

 

2.上传rpm到linux

我这里用的xshell,没有安装xftp

 

在sftp输入 put命令,选择下载好的rpm包即可上传:

 

3.安装

已经上传好的rpm如下:

通过 rpm -ivh mysql-community-****-5.7.26-1.el7.x86_64.rpm --force --nodeps 进行安装,***表示common 、libs、client、server

安装顺序 common-->libs-->client-->server

如果没有--force --nodeps会出现告警:

  warning: mysql-community-common-5.7.26-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

 4.配置

启动mysql服务 :

[root@localhost ~]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service
[root@localhost ~]#

找到初始密码:

[root@localhost ~]# cat /var/log/mysqld.log |grep password
2019-06-02T08:39:38.448115Z 1 [Note] A temporary password is generated for root@localhost: dLZMCRv?s2q)
2019-06-02T08:40:41.870130Z 2 [Note] Access denied for user 'root'@'localhost' (using password: NO)

登陆mysql:

[root@localhost ~]# mysql -u root -p

密码为上面找到的dLZMCRv?s2q)

修改root密码:

mysql> alter user 'root'@'localhost' identified by 'newpasswd';

允许远程连接:

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'newpasswd' WITH GRANT OPTION;

mysql> FLUSH PEIVLEGES;

关闭防火墙:

[root@localhost ~]# systemctl stop firewalld.service

 

posted on 2019-06-02 18:47  大漠飞沙  阅读(7168)  评论(3编辑  收藏  举报