Liunx环境安装Mysql5.7

2017-09-13 12:25:38来源:CSDN作者:m0_37949684人点击

分享

1、按流程安装Mysql

// 下载rpm安装包# wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm// 安装mysql源# yum localinstall mysql57-community-release-el7-8.noarch.rpm// 检查mysql源是否安装成功# yum repolist enabled | grep "mysql.*-community.*"> mysql-connectors-community/x86_64 MySQL Connectors Community                  3> mysql-tools-community/x86_64      MySQL Tools Community                       4> mysql57-community/x86_64          MySQL 5.7 Community Server                 18// 安装mysql# yum install mysql-community-server# yum install mysql-community-devel// 启动mysql# service mysqld start// 查看mysql启动状态# service mysqld status// 设置开机启动# systemctl enable mysqld# systemctl daemon-reload// 获取mysql默认生成的密码# grep 'temporary password' /var/log/mysqld.log> 2017-07-04T06:06:06.824762Z 1 [Note] A temporary password is generated for root@localhost: h8wob/ou+wpC// :(冒号)后的就是自动生成的密码 h8wob/ou+wpC ,换成自己的密码# mysql -uroot -p > Enter password:h8wob/ou+wpC> mysql>// 更换密码> mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123IsYourNewPassword!';

注意:这里的新密码必须包含数字、小写或大写字母、特殊字符串。这个密码的复杂程度,和validate_password_policy的值有关。

PolicyTests Performed
0 or LOWLength
1 or MEDIUMLength; numeric, lowercase/uppercase, and special characters
2 or STRONGLength; numeric, lowercase/uppercase, and special characters; dictionary file

默认是1,即MEDIUM。如果想要降低密码复杂度,可以进入mysql后设置。

> mysql> set global validate_password_policy=0;// 退出后再确认一次> mysql> quit;# mysql -uroot -p123IsYourNewPassword!> mysql>
  • 1
  • 2
  • 3
  • 4
  • 5

至此,mysql安装完毕


最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台