Blogger Information
Blog 8
fans 0
comment 1
visits 23549
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
CentOS 7.2 yum方式安装MySQL 5.7
月落之南宫飞雪
Original
920 people have browsed it

CentOS 7.2 yum方式安装MySQL 5.7

CentOS 7之后的版本yum的默认源中使用MariaDB替代原先MySQL,因此安装方式较为以往有一些改变:

下载mysql的源

wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm

 

安装yum库

yum localinstall -y mysql57-community-release-el7-7.noarch.rpm

 

安装MySQL

yum install -y mysql-community-server

 

启动MySQL服务

systemctl start mysqld.service

 

MySQL5.7加强了root用户的安全性,因此在第一次安装后会初始化一个随机密码,以下为查看初始随机密码的方式

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

结果如下:

 

使用初始随机密码登录后MySQL会强制要求修改密码,否则无法正常使用,(密码必须包含小写、大写字母及特殊字符,当然也有其他方法不受此限制,再次不多做描述),修改方法如下:

SET PASSWORD = PASSWORD('your new password');ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
flush privileges;

然后退出后即可用新密码登录。

远程连接授权:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'your password' WITH GRANT OPTION;

 

开通端口(默认3306):

firewall-cmd --add-port=3306/tcp


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post