• Centos7离线安装mysql8 glibc版本


    1.查看mysql是否安装

    yum list installed mysql*
    或者:
    rpm -qa | grep -i mysql

    2.卸载

    yum remove mysql*

    3.删除残留文件

    find / -name mysql

    rm -rf /var/lib/mysql
    rm -rf /etc/my.cnf
    rm -rf /etc/profile.d/mysql.sh
    rm -rf /etc/init.d/mysql

    4.杀掉进程

    ps -ef|grep mysql

    5.建用户
    useradd mysql

    6.切用户

    su - mysql

    7.参考官方安装文档:https://dev.mysql.com/doc/refman/8.0/en/binary-installation.html

    8.安装依赖包-root

    yum install libaio

    9.删除原有mariadb的配置文件-root

    rm -rf /etc/my.cnf

    10.下载glibc版本、解压、改文件名-mysql、建一些依赖目录

    >wget https://mirrors.aliyun.com/mysql/MySQL-8.0/mysql-8.0.28-linux-glibc2.12-x86_64.tar.xz
    >tar xvf mysql-8.0.28-linux-glibc2.12-x86_64.tar.xz
    >mv mysql-8.0.28-linux-glibc2.12-x86_64 mysql-8.0.28

    >cd mysql-8.0.28

    >mkdir mysql-files

    >chown mysql:mysql mysql-files

    >chmod 750 mysql-files

    >mkdir data

    >chmod 755 data

    11.初始化

    >$HOME/mysql-8.0.28/bin/mysqld --initialize --user=mysql --basedir=$HOME/mysql-8.0.28 --datadir=$HOME/mysql-8.0.28/data

    报错:

    [MY-012582] [InnoDB] io_setup() failed with EAGAIN. Will make 5 attempts before giving up.
    vi /etc/sysctl.conf

    解决:root 

    vi /etc/sysctl.conf

    fs.aio-max-nr=1045876
    sysctl -p

    12.建服务

    >bin/mysql_ssl_rsa_setup --datadir=$HOME/mysql-8.0.28/data

    >cp support-files/mysql.server /etc/init.d/mysql

    >vi /etc/rc.d/init.d/mysql 修改2行:
    basedir=/home/mysql/mysql-8.0.28
    datadir=/home/mysql/mysql-8.0.28/data

    13.启动、停止

    [mysql@localhost mysql-8.0.28]$ service mysql start
    Starting MySQL.. SUCCESS!
    [mysql@localhost mysql-8.0.28]$ service mysql status
     SUCCESS! MySQL running (121408)
    [mysql@localhost mysql-8.0.28]$ service mysql stop
    Shutting down MySQL.. SUCCESS!
    [mysql@localhost mysql-8.0.28]$

    12.改密码
    /home/mysql/mysql-8.0.28/bin/mysql -uroot -p
    alter user 'root'@'localhost' identified with mysql_native_password by '123456';
    flush privileges;

    13.开启远程连接

    use mysql;
    update user set host='your ip' where user='root'; //指定ip
    update user set host='%' where user='root';//任意ip都可以连
    flush privileges;

  • 相关阅读:
    umi4+vue3开发模板摸索
    1 分布式锁
    JPA 查询的类型
    使用 Web Workers
    Python | 24K纯新手的Python环境搭建之路!~(Anaconda + Jupyter)
    启动速度提升 10 倍:Apache Dubbo 静态化方案深入解析
    博睿数据一体化智能可观测平台入选中国信通院2022年“云原生产品名录”
    代码审计及示例
    vue-router导入视图文件方式与打包参数的差异
    早期Java Swing的eclipse项目导入idea使用
  • 原文地址:https://blog.csdn.net/mnbwz/article/details/132871300