美文网首页
mysql安装(linux)

mysql安装(linux)

作者: jimy123 | 来源:发表于2023-01-28 11:38 被阅读0次

    8.0版本:

    • 下载mysql yun源:
    wget http://dev.mysql.com/get/mysql80-community-release-el7-7.noarch.rpm
    
    • 安装yum源:
    yum localinstall mysql-community-release-el7-5.noarch.rpm
    或
    rpm -ivh mysql-community-release-el7-5.noarch.rpm
    
    • 验证是否添加成功:
    yum repolist enabled | grep "mysql*"
    
    • 安装mysql:
    # 查看mysql安装包:
    yum list | grep mysql
    # 查看安装包信息
    yum info mysql-community-server
    # 查看yum安装目录:
    rpm -ql mysql-community-server
    # 安装mysql:
    yum install -y mysql-community-server
    
    • 启动服务:
    systemctl status mysqld #查看服务状态
    systemctl start mysqld #启动服务
    systemctl stop mysqld #停止服务
    systemctl restart mysqld #重启服务
    
    service mysql status
    service mysql start
    service mysql stop
    
    • 查看初始密码:
    grep 'password' /var/log/mysqld.log
    
    • 修改密码:
    alter user 'root'@'localhost' identified by 'Root_123';
    flush privileges;
    
    • 修改密码策略:
    # 修改密码复杂度:0:LOW   1:MEDIUM    2:STRONG
    set global validate_password.policy=0;
    # 密码最小长度:
    set global validate_password.length=6;
    

    卸载:

    • 停止服务:
    systemctl stop mysqld
    
    • 删除安装包:
    rpm -qa | grep mysql
    rpm -qa | grep mysql | xargs rpm -e
    rpm -qa | grep mysql
    

    相关文章

      网友评论

          本文标题:mysql安装(linux)

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