Centos7上安装MySQL community步骤

编程入门 行业动态 更新时间:2024-10-24 22:29:01

下载mysql80-community-release-el7-3.noarch.rpm软件源包文件 

MySQL Community Yum Repository Downloads

shell> sudo yum localinstall mysql80-community-release-el7-3.noarch.rpm

列出可安装的MySQL版本:

shell> yum repolist all | grep mysql

列表如下:

Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository epel is listed more than once in the configuration
Repository epel-debuginfo is listed more than once in the configuration
Repository epel-source is listed more than once in the configuration
mysql-cluster-7.5-community/x86_64 MySQL Cluster 7.5 Community   disabled
mysql-cluster-7.5-community-source MySQL Cluster 7.5 Community - disabled
mysql-cluster-7.6-community/x86_64 MySQL Cluster 7.6 Community   disabled
mysql-cluster-7.6-community-source MySQL Cluster 7.6 Community - disabled
mysql-cluster-8.0-community/x86_64 MySQL Cluster 8.0 Community   disabled
mysql-cluster-8.0-community-source MySQL Cluster 8.0 Community - disabled
mysql-connectors-community/x86_64  MySQL Connectors Community    enabled:    118
mysql-connectors-community-source  MySQL Connectors Community -  disabled
mysql-tools-community/x86_64       MySQL Tools Community         enabled:     95
mysql-tools-community-source       MySQL Tools Community - Sourc disabled
mysql-tools-preview/x86_64         MySQL Tools Preview           disabled
mysql-tools-preview-source         MySQL Tools Preview - Source  disabled
mysql55-community/x86_64           MySQL 5.5 Community Server    disabled
mysql55-community-source           MySQL 5.5 Community Server -  disabled
mysql56-community/x86_64           MySQL 5.6 Community Server    disabled
mysql56-community-source           MySQL 5.6 Community Server -  disabled
mysql57-community/x86_64           MySQL 5.7 Community Server    disabled
mysql57-community-source           MySQL 5.7 Community Server -  disabled
mysql80-community/x86_64           MySQL 8.0 Community Server    enabled:    129
mysql80-community-source           MySQL 8.0 Community Server -  disabled

默认安装最新版本的MySQL,如果要安装低版本(如5.7)的需要切换软件源的版本:

shell> sudo yum-config-manager --disable mysql80-community
shell> sudo yum-config-manager --enable mysql57-community

切换之后/etc/yum.repos.d/mysql-community.repo 文件将会发生变化

 

好了,开始安装

shell> sudo yum install mysql-community-server

安装完成启动服务:

shell> sudo service mysqld start
Starting mysqld:[ OK ]

或者

shell> sudo systemctl start mysqld
Starting mysqld:[ OK ]

首次启动时会做服务初始化,并创建'root'@'localhost 的账号密码,可通过一下命令查看:

shell> sudo grep 'temporary password' /var/log/mysqld.log

登录并修改密码:

shell> mysql -uroot -p

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

 

更多推荐

Centos7上安装MySQL community步骤

本文发布于:2023-06-14 02:26:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1427550.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:步骤   MySQL   community

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!