【MySQL】在centos7 纯IPv6环境下,安装mysql5.7

    技术2022-07-11  122

    参考链接:https://mirrors6.tuna.tsinghua.edu.cn/help/mysql/

    服务器环境: Centos7 纯IPv6环境(不能与IPv4互通)

    按照 https://mirrors6.tuna.tsinghua.edu.cn/help/mysql/ 步骤操作完成

    执行 yum install mysql-community-server 发现默认安装 mysql 8.0,

    问题:提示找不到签名,因为https://repo.mysql.com/ 只有v4地址,估将https://repo.mysql.com/RPM-GPG-KEY-mysql 下载至 /root 目录下,

    修改 /etc/yum.repos.d/mysql-community.repo

    [mysql-connectors-community] name=MySQL Connectors Community baseurl=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-connectors-community-el7-$basearch/ enabled=1 gpgcheck=1 gpgkey=https://repo.mysql.com/RPM-GPG-KEY-mysql [mysql-tools-community] name=MySQL Tools Community baseurl=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-tools-community-el7-$basearch/ enabled=1 gpgcheck=1 gpgkey=https://repo.mysql.com/RPM-GPG-KEY-mysql [mysql-5.6-community] name=MySQL 5.6 Community Server baseurl=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-5.6-community-el7-$basearch/ enabled=0 gpgcheck=1 gpgkey=https://repo.mysql.com/RPM-GPG-KEY-mysql [mysql-5.7-community] name=MySQL 5.7 Community Server baseurl=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-5.7-community-el7-$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///root/RPM-GPG-KEY-mysql #gpgkey=https://repo.mysql.com/RPM-GPG-KEY-mysql # 注释 8.0 #[mysql-8.0-community] #name=MySQL 8.0 Community Server #baseurl=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-8.0-community-el7-$basearch/ #enabled=1 #gpgcheck=1 #gpgkey=https://repo.mysql.com/RPM-GPG-KEY-mysql

    再次执行 yum install mysql-community-server 成功安装

    启动mysql服务 systemctl start mysqld

    进入 mysql mysql -u root -p ,回车

    问题:需要密码,从安装到启动服务,也没有设置过密码啊,故更改配置,免密登录

    更改配置文件/etc/my.cnf [mysqld] skip-grant-tables

    启动mysql服务 systemctl restart mysqld

    再次执行 mysql -u root -p ,回车成功进入,更改root 密码

    update mysql.user set authentication_string=PASSWORD('xxx') where user='root' and host='localhost'; flush privileges; exit;

    关闭 免密登录,即 注释 skip-grant-tables (第7步),重启mysql

    测试登录 mysql -u root -p

    结束安装

    Processed: 0.014, SQL: 10