当前位置:   article > 正文

Linux中yum安装MySQL及卸载_yum -y module disable mysql

yum -y module disable mysql

MySQL安装

  1. 先下载mysql的repo源

    wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
  2. yum安装mysql源包

    yum -y install mysql57-community-release-el7-10.noarch.rpm
  3. 安装MySQL

    1. 用yum module disable mysqL先禁用本地的 MySQL 模块

      yum module disable mysql
    2. 安装mysql

      yum -y install mysql-community-server
  4. 启动MySQL

    systemctl start  mysqld.service
  5. 查看MySQL初始密码

    grep "password" /var/log/mysqld.log
  6. 登录数据库

    mysql -uroot -p
  7. 修改MySQL默认密码

    1. 修改密码安全策略为低(只校验密码长度,至少8位)

      set global validate_password_policy=0;
    2. 修改密码

      ALTER USER 'root'@'localhost' IDENTIFIED BY '12345678';
  8. 授予root用户远程管理权限

    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '12345678';
  9. 刷新数据库

    FLUSH  PRIVILEGES;
  10. 退出数据库

    exit

MySQL卸载

  1. 查看已安装的mysql

    rpm -qa | grep -i mysql
  2. 卸载mysql

    1. 卸载mysql

      yum remove mysql-community-server-5.6.36-2.el7.x86_64
    2. 查看mysql的其它依赖:

      rpm -qa | grep -i mysql
  3. //卸载依赖

    1. yum remove mysql-libs
    ​
    2. yum remove mysql-server
    ​
    3. yum remove perl-DBD-MySQL
    ​
    4. yum remove mysql

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/537434
推荐阅读
相关标签
  

闽ICP备14008679号