原文链接:http://www.jb51.cc/article/p-qzrplfnn-xp.html
安装环境:CentOS7 64位 MINI版,安装MysqL5.7
1、配置YUM源
在 MySQL官网中下载YUM源rpm安装包: http://dev.mysql.com/downloads/repo/yum/@H_502_7@ # 下载MysqL源安装包@H_502_7@ shell> wget http://dev.MysqL.com/get/MysqL57-community-release-el7-8.noarch.rpm@H_502_7@ # 安装MysqL源@H_502_7@ shell> yum localinstall MysqL57-community-release-el7-8.noarch.rpm
@H_502_7@
检查MysqL源是否安装成功
[root@localhost home]# yum repolist enabled | grep "MysqL.*-community.*" @H_502_7@ MysqL-connectors-community/x86_64 MysqL Connectors Community 3 @H_502_7@ MysqL-tools-community/x86_64 MysqL Tools Community 4 @H_502_7@ MysqL57-community/x86_64 MysqL 5.7 Community Server 18@H_502_7@
看到上图所示表示安装成功
@H_502_7@
2、安装MysqL
shell> yum install MysqL-community-server
3、启动MysqL服务
shell> systemctl start MysqLd
查看MysqL的启动状态
[root@localhost home]# systemctl status MysqLd MysqLd.service - MysqL Server Loaded: loaded (/usr/lib/systemd/system/MysqLd.service; enabled) Active: active (running) since 一 2017-06-26 21:23:21 EDT; 14s ago Docs: man:MysqLd(8) http://dev.MysqL.com/doc/refman/en/using-systemd.html Process: 21186 ExecStart=/usr/sbin/MysqLd --daemonize --pid-file=/var/run/MysqLd/MysqLd.pid $MysqLD_OPTS (code=exited,status=0/SUCCESS) Process: 21108 ExecStartPre=/usr/bin/MysqLd_pre_systemd (code=exited,status=0/SUCCESS) Main PID: 21190 (MysqLd) CGroup: /system.slice/MysqLd.service └─21190 /usr/sbin/MysqLd --daemonize --pid-file=/var/run/MysqLd/my... 6月 26 21:23:21 localhost.localdomain systemd[1]: Started MysqL Server.
4、开机启动
shell> systemctl enable MysqLd
shell> systemctl daemon-reload
5、修改root默认密码
MysqL安装完成之后,在/var/log/MysqLd.log文件中给root生成了一个默认密码。通过下面的方式找到root默认密码,然后登录MysqL进行修改:
@H_502_7@或者
注意:MysqL5.7默认安装了密码安全检查插件(validate_password),默认密码检查策略要求密码必须包含:大小写字母、数字和特殊符号,并且长度不能少于8位。否则会提示ERROR 1819 (HY000): Your password does not satisfy the current policy requirements错误,如下图所示:
set password for 'root'@'localhost'=password('208170'); ERROR 1819 (HY000): Your password does not satisfy the current policy requirements@H_502_7@ @H_502_7@通过msyql环境变量可以查看密码策略的相关信息:
共有以下几种密码策略:
策略 | 检查规则 |
---|---|
0 or LOW | Length |
1 or MEDIUM | Length; numeric,lowercase/uppercase,and special characters |
2 or STRONG |
MysqL官网密码策略详细说明:http://dev.mysql.com/doc/refman/5.7/en/validate-password-options-variables.html#sysvar_validate_password_policy
修改密码策略 ( zhe ge di fang you dian wen ti bu yao cao zuo)在/etc/my.cnf文件添加validate_password_policy配置,指定密码策略
如果不需要密码策略,添加my.cnf文件中添加如下配置禁用即可:
原文链接:https://www.f2er.com/centos/377037.html
猜你在找的CentOS相关文章 |