linux(CentOS7)上安装MySql5.7

① 第一种方式:在线安装(不推荐,下载安装包太耗时间了)
 

② 第二种方式:使用rpm安装包进行安装
 
安装步骤如下
  • 安装client:rpm -ivh mysql-community-client-5.7.29-1.el7.x86_64.rpm --nodeps --force
  • 安装server:rpm -ivh mysql-community-server-5.7.29-1.el7.x86_64.rpm --nodeps --force
  • 启动mysql:systemctl start mysqld
  • 设置开机自启:systemctl enable mysqld
  • 查看临时密码:grep 'password' /var/log/mysqld.log
  • 修改密码策略:set global validate_password_policy=0;
  • 修改密码可设置长度:set global validate_password_policy=0;
  • 设置密码:alter user 'root'@'localhost' identified by '123456';
    • 这不如果不行,执行以下语句
mysql> set global validate_password_policy=0;
mysql> set global validate_password_mixed_case_count=0;
mysql> set global validate_password_number_count=3;
mysql> set global validate_password_special_char_count=0;
mysql> set global validate_password_length=3;
  • 授权远程访问:grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;

 最后都需要执行的四步:
 
set global validate_password_policy=0;
set global validate_password_length=1;
alter user 'root'@'localhost' identified by '123456';
授权远程访问
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
posted @ 2020-03-19 08:59  孤僻的小孩  阅读(170)  评论(0编辑  收藏  举报