CentOS7.3(64位)安装mysql5.7
博客专区 > tryme 的博客 > 博客详情
CentOS7.3(64位)安装mysql5.7
tryme 发表于3个月前
CentOS7.3(64位)安装mysql5.7
  • 发表于 3个月前
  • 阅读 0
  • 收藏 0
  • 点赞 0
  • 评论 0
  1. mysql官网下载文件https://dev.mysql.com/downloads/mysql/ 
    选择系统版本

    勾选如下选项下载:
  2. 上传服务器并解压
    tar -xvf mysql-5.7.19-1.el7.x86_64.rpm-bundle.tar


    ps:CentOS7预装MariaDB,可能有冲突,先卸载

    rpm -qa |grep -i mariadb
    rpm -e --nodeps mariadb-libs-5.5.52-1.el7.x86_64

     

  3. 开始安装
     

    rpm -ivh mysql-community-common-5.7.19-1.el7.x86_64.rpm
    rpm -ivh mysql-community-libs-5.7.19-1.el7.x86_64.rpm
    rpm -ivh mysql-community-libs-compat-5.7.19-1.el7.x86_64.rpm 
    rpm -ivh mysql-community-client-5.7.19-1.el7.x86_64.rpm
    rpm -ivh mysql-community-server-5.7.19-1.el7.x86_64.rpm
    rpm -ivh mysql-community-devel-5.7.19-1.el7.x86_64.rpm

    倒数第二步可能会报如下错误:

    原因:缺少libaio库
    解决方案:

    安装libaio库 http://mirror.centos.org/centos/6/os/x86_64/Packages/libaio-0.3.107-10.el6.x86_64.rpm

    rpm -ivh libaio-0.3.107-10.el6.x86_64.rpm

  4. 启动mysql服务并设置开机启动

    systemctl start mysqld
    
    systemctl enable mysqld
    systemctl daemon-reload

     

  5. 根据临时密码登录mysql
     

    vi /var/log/mysqld.log

  6. 修改密码
    登录后必须修改密码,不然无法执行sql语句,会报如下错误:

    ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.


    当执行

    ALTER USER 'root'@'localhost' IDENTIFIED BY 'wang123';

    修改密码时又会报一下错误:

    ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

    这个错误与validate_password_policy密码策略有关
     

    mysql密码策略
    Policy Tests Performed
    0 or LOW Length
    1 or MEDIUM Length; numeric, lowercase/uppercase, and special characters
    2 or STRONG Length; numeric, lowercase/uppercase, and special characters; dictionary file

    执行以下代码修改策略,此时只会基于长度判断

    set global validate_password_policy=0;

     

未完,待续!

标签: MySQL CentOS
共有 人打赏支持
粉丝 0
博文 7
码字总数 1801
×
tryme
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: