美文网首页
CentOS7.4下rpm安装mysql5.7.24

CentOS7.4下rpm安装mysql5.7.24

作者: cxy_0a65 | 来源:发表于2018-12-03 23:19 被阅读0次

    1.下载mysql

    在/mydevelop/mysql/目录下执行命令

    wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.24-1.el7.x86_64.rpm-bundle.tar

    或者直接在浏览器打开链接,下载后上传到服务器/mydevelop/mysql/

    https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.24-1.el7.x86_64.rpm-bundle.tar

    2.解压

    tar -xvf mysql-5.7.24-1.el7.x86_64.rpm-bundle.tar

    蓝线画出的四个包为安装所需要的包

    3.安装前环境清理

    首先查看有没有安装mysql或mariadb

    rpm -qa | grep mariadb

    rpm -qa | grep mysql

    如果存在的话   rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64     命令卸载全部包

    卸载mysql要完全删除干净(卸载包及删除文件)

    4.安装

    安装Mysql安装顺序安装

    rpm -ivh mysql-community-common-5.7.24-1.el7.x86_64.rpm

    rpm -ivh mysql-community-libs-5.7.24-1.el7.x86_64.rpm

    rpm -ivh mysql-community-client-5.7.24-1.el7.x86_64.rpm

    rpm -ivh mysql-community-server-5.7.24-1.el7.x86_64.rpm

    安装rpm -ivh mysql-community-server-5.7.24-1.el7.x86_64.rpm可能会报错:

    error: Failed dependencies:

            libaio.so.1()(64bit) is needed by mysql-community-server-5.7.24-1.el7.x86_64.....

    缺少libaio包 安装   yum install libaio  后再安装  rpm -ivh mysql-community-server-5.7.24-1.el7.x86_64.rpm  则可以

    5.启动

    启动Mysql服务 : systemctl start mysqld

    查看MySQL服务器的状态: systemctl status mysqld

    设置开机启动:systemctl enable mysqld

    生成随机密码 :grep 'temporary password' /var/log/mysqld.log

    初始化默认密码

    mysql -uroot -p屏幕上的随机密码

    ALTER USER 'root'@'localhost' IDENTIFIED BY 'SHSac@2018';

    允许root用户在任何地方进行远程登录,并具有所有库任何操作权限

    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'SHSac@2018' WITH GRANT OPTION;

    刷新权限

    FLUSH PRIVILEGES;

    相关文章

      网友评论

          本文标题:CentOS7.4下rpm安装mysql5.7.24

          本文链接:https://www.haomeiwen.com/subject/vefpcqtx.html