menu Chancel's blog
rss_feed
Chancel's blog
我就是这样的人

Linux下安装指定版本的MySQL

作者:Chancel, 更新:2019 Dec 05, 字数:1762, 已阅:636

这篇文章更新于 1278 天前,文中部分信息可能失效,请自行甄别无效内容。

有时候需要安装某些指定版本的MySQL,故写一篇如何安装指定版本的,以供参考

  • 参考文档
    • 官网文档:https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/
    • 官网下载:https://dev.mysql.com/downloads/repo/yum/
    • 博客:https://www.cnblogs.com/weiok/p/5373270.html

版本区别

  • MySQL Community Server
    • 社区版本,开源免费,但不提供官方技术支持。
  • MySQL Enterprise Edition
    • 企业版本,需付费,可以试用30天。
  • MySQL Cluster
    • 集群版,开源免费。可将几个MySQL Server封装成一个Server。
  • MySQL Cluster CGE
    • 高级集群版,需付费。
  • MySQL Workbench(GUI TOOL)
    • 一款专为MySQL设计的ER/数据库建模工具。它是著名的数据库设计工具DBDesigner4的继任者。
  • MySQL Workbench OSS
    • MySQL Workbench社区版
  • MySQL Workbench SE
    • MySQL Workbench商用版
  • MySQL Community Server
    • 开源免费的,这也是我们通常用的MySQL的版本。根据不同的操作系统平台细分为多个版本,

安装步骤

1. 从官网下载repo包

  • 地址:https://dev.mysql.com/downloads/repo/yum/

根据你的系统选择repo包 如果你的是ReHat系的,则可用以下链接

wget https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm

2. 安装repo包

先查看repo包包含哪些包?

rpm -qpl mysql80-community-release-el7-1.noarch.rpm

安装repo包

rpm -ivh mysql80-community-release-el7-1.noarch.rpm

3. 安装指定版本

手动编辑/etc/yum.repos.d/mysql-community.repo

vim /etc/yum.repos.d/mysql-community.repo

enabled=0禁用版本,enabled=1启用指定版本

4. 查询已经启动跟禁用的版本

yum repolist enabled | grep mysql

5. 使用yum安装指定版本

yum install mysql-community-server

5.7部署步骤

PS:接下来顺便说说部署步骤,如果不需要可以忽略了

1. 启动MySQL

systemctl start mysqld

2. 查看初始密码(5.7版本会有初始密码,记录在安装日志中)

grep 'temporary password' /var/log/mysqld.log 

3. 修改密码

如果想设置比较简单的本地密码(root用户通常也不开放远程登录权限,本地的话复杂没什么意义),先必须修改安全等级

set global validate_password_policy=0;

接着再修改密码

alter user root@localhost identified by 'yourpasswd';

4. 启动远程登录

grant all privileges  on *.* to user@'%' identified by "yourpasswd"
flush privileges;

[[replyMessage== null?"发表评论":"发表评论 @ " + replyMessage.m_author]]

account_circle
email
web_asset
textsms

评论列表([[messageResponse.total]])

还没有可以显示的留言...
[[messageItem.m_author]] [[messageItem.m_author]]
[[messageItem.create_time]]
[[getEnviron(messageItem.m_environ)]]
[[subMessage.m_author]] [[subMessage.m_author]] @ [[subMessage.parent_message.m_author]] [[subMessage.parent_message.m_author]]
[[subMessage.create_time]]
[[getEnviron(messageItem.m_environ)]]
目录