下载,需要下四个包
rpm -qa | grep -i mysql //检查是否安装mysql
按照依赖关系依次安装rpm包 依赖关系依次为common→libs→client→server
ivh中, i-install//安装;v-verbose//进度条;h-hash//哈希校验
yum remove mysql-libs //删除libs 不然依赖包会报错
rpm -ivh mysql-community-common-5.7.34-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.34-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.34-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.34-1.el7.x86_64.rpm
systemctl start mysqld.service //启动mysql
systemctl status mysqld.service //查看mysql状态
systemctl stop mysqld.service //关闭mysql
grep 'temporary password' /var/log/mysqld.log //查看生成的秘码
set global validate_password_policy=0; 设置密码要求0代码大于8位任意数字,字母,单类就可以
set password for root@localhost=password('9527');
防火墙设置
firewall-cmd --zone=public --add-port=3306/tcp --permanent
命令含义:
--zone : 作用域
--add-port=3306/tcp : 添加端口,格式为:端口/通讯协议
--permanent : 永久生效,没有此参数重启后失效
firewall-cmd --reload //重启防火墙