下载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步骤
发布评论