美文网首页
CentOS7安装Mysql

CentOS7安装Mysql

作者: zmwise | 来源:发表于2018-07-24 17:15 被阅读0次

    1 、检查 MySQL 是否已安装

    yum list installed | grep mysql
    yum -y remove + databaseName

    2、MySQL 依赖 libaio,所以先要安装 libaio

      yum search libaio # 检索相关信息
      yum install libaio # 安装依赖包
    

    3、下载Mysql

      wget https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm
    
    

    4、安装

    安装mysql yum repository

      yum localinstall mysql57-community-release-el7-11.noarch.rpm
    

    确认yum repository已经安装

      yum repolist enabled | grep "mysql.*-community.*"
    

    查看MySQL版本

    yum repolist all | grep mysql
    

    安装

    yum install mysql-community-server
    

    5、启动和配置MySQL服务

    修改MySQL配置文件/etc/my.cnf

     vim /etc/my.cnf
    

    启动MySQL服务

    systemctl start  mysqld
    

    查看 MySQL Server 状态

    systemctl status mysqld
    

    关闭 MySQL Server

    systemctl stop mysqld
    

    6、测试是否安装成功

      mysql
    

    7、查看生成mysql root用户临时密码

      grep 'temporary password' /var/log/mysqld.log
    

    8、修改root用户的密码

      mysql -uroot -p #输入临时密码
      ALTER USER 'root'@'localhost' IDENTIFIED BY 'your password';
    

    更多spring boot/spring cloud学习资源:
    https://download.csdn.net/download/wiseap/10364359
    更多区块链学习资源:
    https://download.csdn.net/download/wiseap/10319848

    相关文章

      网友评论

          本文标题:CentOS7安装Mysql

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