• yum 安装mysql


    安装依赖
    yum install libaio wget -y
    检查MYSQL是否已安装
    yum list installed | grep mysql

    如果有先卸载

    # 格式 yum -y remove [包名]
    yum -y remove mysql-libs.x86_64

    下载MySQL官网的仓库文件

    cd /tmp
    
    wget http://repo.mysql.com/mysql80-community-release-el7-1.noarch.rpm
    
    yum localinstall mysql80-community-release-el7-1.noarch.rpm

    验证仓库是否添加成功

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

    安装MySQL

    yum install mysql-community-server -y

    时MySQL 安装完成,它包含了 

    mysql-community-server、mysql-community-client
    mysql-community-common、mysql-community-libs 四个包

    执行

    rpm -qi mysql-community-server.x86_64 0:8.0.16-2.el7

    然后

    whereis mysql

    可以看到MySQL 的安装目录是 /usr/bin/

    启动服务

    systemctl start mysqld
    
    systemctl enable mysqld
    
    systemctl status mysqld

    查找初始密码

    cat /var/log/mysqld.log | grep password
    mysql -uroot -p

    mysql> ALTER USER 'root'@'%' IDENTIFIED BY 'hbV0pOO!(Z#R' PASSWORD EXPIRE NEVER;

    mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'hbV0pOO!(Z#R';

    mysql> FLUSH PRIVILEGES;

    mysql> alter user 'root'@'%' identified by 'hbV0pOO!(Z#R';

    测试连接

  • 相关阅读:
    python 中 print函数的用法详解
    可转债操作一览
    Python基本数据类型
    python的列表
    理财的方法
    92、Multiple commands produce Info.plist 报错
    91、最新cocoaPods安装与使用
    90、引入头文件不提示
    89、instancetype和id的区别
    88、const、static、extern介绍
  • 原文地址:https://www.cnblogs.com/executive-1314/p/14850179.html
Copyright © 2020-2023  润新知