mysql安装
1.下载
wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
2.repo安装
rpm -ivh mysql57-community-release-el7-9.noarch.rpm
执行完成后会在/etc/yum.repos.d/目录下生成两个repo文件mysql-community.repo mysql-community-source.repo
3.yum安装
cd /etc/yum.repos.d/
yum install mysql-server
4.启动
systemctl start mysqld #启动MySQL
5.获取root密码
grep 'temporary password' /var/log/mysqld.log
[root@tv2-callchain-tool-01 mysql]# grep 'temporary password' /var/log/mysqld.log
2020-11-29T01:19:33.658808Z 1 [Note] A temporary password is generated for root@localhost: z_LQ-M_Oh1#L
6.登录
mysql -u root -p
7.修改密码强度
mysql> set global validate_password_policy=0; Query OK, 0 rows affected (0.00 sec)
8.validate_password_length(密码长度)参数默认为8,我们修改为1
mysql> set global validate_password_length=1; Query OK, 0 rows affected (0.00 sec)
9.修改密码
mysql> alter user 'root'@'localhost' identified by '123456'; Query OK, 0 rows affected (0.00 sec)
10.退出
mysql> exit
Bye
11.重新登录,输入新密码就行了