Linux centos7安装MySQL5.7:跳过临时密码
0x00 centos安装MySQL5.7 遇到问题
临时密码登录失败,跳过临时密码
0x01 安装
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server
systemctl start mysqld.service
systemctl status mysqld.service
0x02 跳过临时密码修改密码
1.vim /etc/my.cof
在socket=/var/lib/mysql/mysql.sock上一行添加skip-grant-tables
2.重启mysql
service mysqld restart
3.登录
mysql -u root #此时不需要密码,可以直接登录
4.修改密码root的md5:*81F5E21E35407D884A6CD4A731AEBFB6AF209E1B
use mysql
update user set \`authentication_string\`='*81F5E21E35407D884A6CD4A731AEBFB6AF209E1B' where user='root';
5.清除并退出
flush privileges;
6.修改my.cnf
删除1.中添加内容
0x03 修改密码限制
mysql> show variables like “%validate%”;
mysql> set global validate_password_length=6;##密码的最小长度,改成6
mysql> set global validate_password_policy=0;#这个改成0,就可以接受简单的密码
mysql> alter user ‘root’@‘localhost’ identified by ‘123123’;
0x04 设置内网访问
设置内网访问:
mysql> GRANT ALL PRIVILEGES ON . TO ‘root’@’%'IDENTIFIED BY ‘root’ WITH GRANT OPTION;
mysql> flush privileges;
重启mysql