当前位置:   article > 正文

CentOS7 安装MySQL

centos7 安装mysql


官方安装教程:

https://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html

1.查看是否已安装

1.查看系统中是否已安装 MySQL 服务

$ rpm -qa | grep mysql
  • 1

$ yum list installed | grep mysql
  • 1

2.如果已安装则删除 MySQL 及其依赖的包

$ yum -y remove mysql-libs.x86_64
  • 1

2.下载源

1.下载 mysql57-community-release-el7-8.noarch.rpm 的 YUM 源:

$ wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
  • 1

2.安装 mysql57-community-release-el7-8.noarch.rpm:

$ yum localinstall mysql57-community-release-el7-8.noarch.rpm
  • 1

3.检查mysql源是否安装成功

 yum repolist enabled | grep "mysql.*-community.*"
 
  • 1
  • 2
[root@sinotest1 jenkins]# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64        MySQL Connectors Community           51                                       
mysql-tools-community/x86_64             MySQL Tools Community                63                                       
mysql57-community/x86_64                 MySQL 5.7 Community Server          267 
  • 1
  • 2
  • 3
  • 4

4.安装

1.安装 MySQL:

yum -y install mysql-community-server
  • 1

启动mysql:

systemctl start mysqld
  • 1

2.查找初始密码:

mysql安装完成之后,在 /var/log/mysqld.log 文件中给root生成了一个默认密码

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

打印如下内容:

[root@sinotest1 jenkins]# grep 'temporary password' /var/log/mysqld.log
2018-06-07T02:46:39.003245Z 1 
  • 1
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/码创造者/article/detail/953516
推荐阅读
相关标签
  

闽ICP备14008679号