mysql yum安装
1 创建mysql.repo文件 2 [root@centos7 ~]#tee /etc/yum.repos.d/mysql.repo <<EOF 3 [mysql] 4 name=mysql5.7 5 baseurl=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-5.7-community-el7-x86_64/ 6 gpgcheck=0 7 EOF 8 9 安装msyql 10 [root@centos7 ~]#yum -y install mysql-community-server 11 自启动 12 [root@centos7 ~]#systemctl enable --now mysqld 13 14 查看初始密码 15 [root@centos7 ~]#grep password /var/log/mysqld.log 16 2021-01-27T00:45:09.953242Z 1 [Note] A temporary password is generated for root@localhost: pe%b#S8ah)j- <---密码
17
18 19 #使用初始密码登录无法执行操作,需要修改密码后才可以 20 mysql> status 21 ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. 23 #修改简单密码不符合密码策略 24 mysql> alter user root@'localhost' identified by 'ruigu2023'; 25 ERROR 1819 (HY000): Your password does not satisfy the current policy requirements 27 #修改为复杂密码 28 mysql> alter user root@'localhost' identified by 'Ruigu2023!'; 29 Query OK, 0 rows affected (0.00 sec)