centos7使用rpm安装mysql5.7的教程图解
作者:大漠飞沙
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
在打开的界面,按键盘 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 -ivhmysql-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
总结
以上所述是小编给大家介绍的centos7使用rpm安装mysql5.7的教程图解,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!