码迷,mamicode.com
首页 > 数据库 > 详细

centos7 mysql5.7安装

时间:2020-05-28 00:27:54      阅读:93      评论:0      收藏:0      [点我收藏+]

标签:ide   lang   src   not   fir   没有   sys   lis   lease   

1.下载yum repo

[root@hadoop002 ~]# wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm

2.repo安装

[root@hadoop002 ~]# rpm -ivh mysql57-community-release-el7-9.noarch.rpm

3.修改yum源默认安装版本

[root@hadoop002 ~]# yum repolist all| grep mysql
mysql-connectors-community/x86_64 MySQL Connectors Community        启用:    153
mysql-connectors-community-source MySQL Connectors Community - Sour 禁用
mysql-tools-community/x86_64      MySQL Tools Community             启用:    110
mysql-tools-community-source      MySQL Tools Community - Source    禁用
mysql-tools-preview/x86_64        MySQL Tools Preview               禁用
mysql-tools-preview-source        MySQL Tools Preview - Source      禁用
mysql55-community/x86_64          MySQL 5.5 Community Server        禁用
mysql55-community-source          MySQL 5.5 Community Server - Sour 禁用
mysql56-community/x86_64          MySQL 5.6 Community Server        禁用
mysql56-community-source          MySQL 5.6 Community Server - Sour 禁用
mysql57-community/x86_64          MySQL 5.7 Community Server        启用:    424
mysql57-community-source          MySQL 5.7 Community Server - Sour 禁用
mysql80-community/x86_64          MySQL 8.0 Community Server        禁用
mysql80-community-source          MySQL 8.0 Community Server - Sour 禁用
[root@hadoop002 ~]# vim /etc/yum.repos.d/mysql-community.repo
# 如需修改启动的版本,则修改enabled   1为启用 0位禁用
[root@hadoop002 ~]# yum install -y mysql-community-server

4.启动mysql服务并设置成开机启动

[root@hadoop002 ~]# systemctl start mysqld
[root@hadoop002 ~]# systemctl enable mysqld

5.查看初始密码并修改

[root@hadoop002 ~]# grep ‘password‘ /var/log/mysqld.log
2020-05-27T15:18:23.821599Z 1 [Note] A temporary password is generated for root@localhost: 54O>pi!0lYc*
[root@hadoop002 ~]# mysql -u root -p
mysql> ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘KoiioK12#‘;

6.设置远程访问

mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘KoiioK12#‘ WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;

7.使用workbench连接

如果出现连不上,看看防火墙有没有关闭

systemctl status firewalld 
systemctl stop firewalld
systemctl disable firewalld

技术图片

centos7 mysql5.7安装

标签:ide   lang   src   not   fir   没有   sys   lis   lease   

原文地址:https://www.cnblogs.com/koiiok/p/12977544.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!