centos7用rpm安装mysql5.7【初始用yum安装发现下载非常慢,就考虑本地用迅雷下载rpm方式安装】
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官网:
在打开的界面,按键盘 f12 打开开发者工具,打开后如下:
在官网找到对应的版本:
点击直接下载:
在开发者工具就能找到下载路径:
如下给出了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