当前位置:Gxlcms > 数据库问题 > centos7 yum安装mysql

centos7 yum安装mysql

时间:2021-07-01 10:21:17 帮助过:17人阅读

一 查看版本
cat /etc/redhat-release 

 

二 安装yum源
rpm -ivh https://repo.mysql.com//mysql57-community-release-el7-9.noarch.rpm
备注: 1 如果上面连接失效,请打开下面连接,按照系统版本替换下载连接
       2 默认安装5.7版本,如果要安装5.6版,修改/etc/yum.repos.d/mysql-community.repo
       3 将5.7源的enabled=1改成enabled=0。然后再将5.6源的enabled=0改成enabled=1即可

 

三 安装MySQL
yum install mysql-community-server

 

四 服务启动
systemctl start mysqld
systemctl enable mysqld 

 

五 修改root本地登录密码
mysqladmin -u root  -p oldpass password "newpass"
备注:1 mysql安装完成之后,在/var/log/mysqld.log文件中给root生成了一个默认密码
      2 grep ‘temporary password‘ /var/log/mysqld.log 找到root默认密码
      3 mysql5.7默认安装了密码安全检查插件(validate_password),默认密码检查策略要求密码必须包含:大小写字母、数字和特殊符号,并且长度不能少于8位。否则会提示ERROR 1819 (HY000): Your password does not satisfy the current policy requirements错误 

centos7 yum安装mysql

标签:mysql   start   password   登录密码   enabled   

人气教程排行