centos7下mysql5.7的安装


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


如果没有wget 则安装一下: yum -y install wget


安装mysql源包
#yum localinstall mysql57-community-release-el7-8.noarch.rpm

检查mysql源是否安装成功
# yum repolist enabled | grep "mysql.*-community.*"

看到下图(三个)表示成功:
mysql-connectors-community      MySQL Connectors Community      36
mysql-tools-community           MySQL Tools Community           47
mysql57-community               MySQL5.7 Community Server      189
 
安装MySQL服务
# yum install mysql-community-server

启动MySQL服务
# systemctl start mysqld
 
查看MySQL的启动状态
# systemctl status mysqld

设置开机启动
# systemctl enable mysqld
# systemctl daemon-reload #重新载入
 
查看root默认密码
# grep 'temporary password' /var/log/mysqld.log

修改root密码
# mysql -uroot -p

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Abc1234!';
或者
mysql> set password for'root'@'localhost'=password('Abc1234!');

这时,报了错:

 

注意:mysql5.7默认安装了密码安全检查插件(validate_password),默认密码检查策略要求密码必须包含:大小写字母、数字和特殊符号,并且长度不能少于8位。否则会提示ERROR 1819 (HY000): Your passworddoes not satisfy the current policy requirements错误

处理方法:set global validate_password_policy=4;  设置密码长度为4,这里可以根据自己的需要设置长度。

然后: set password for'root'@'localhost'=password('root');

好了,密码初始化完成。

关闭防火墙:

systemctl stop firewalld.service

重启mysql服务
# systemctl restart mysqld
好了,用你的Navicat连接试试吧。
posted @ 2018-06-22 22:57  浪子_江流儿  阅读(137)  评论(0编辑  收藏  举报