下载rpm
wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
安装
rpm -ivh mysql57-community-release-el7-9.noarch.rpm
yum -y install mysql-server
启动,查询状态,开机自启
systemctl start mysqld
systemctl status mysqld
systemctl enable mysqld
查询密码
grep 'temporary password' /var/log/mysqld.log
登录修改密码
mysql -uroot -p
查询密码规则:
SHOW VARIABLES LIKE 'validate_password%';
降低密码规程:
先将密码安全等级设置为最低
set global validate_password_policy=0;--表示将密码安全等级设置为low
set global validate_password_length=6;--表示将密码长度设置为最小6位
修改密码:
alter user user() identified by "123456";
开启远程访问:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
刷新配置
FLUSH PRIVILEGES;