• MySQL-安装mysql8


    1. 安装配置

    # 解压
    tar -xf mysql-8.0.18-el7-x86_64.tar.gz -C /ups/app/mysql/
    cd /ups/app/mysql/
    mv mysql-8.0.18-el7-x86_64 mysql8
    
    cd mysql8
    mkdir -p {config,logs}
    mkdir -p /ups/data/mydata/mysql8
    chown -R mysql:mysql .
    chown -R mysql:mysql /ups/data/mydata/mysql8
    chmod 700 /ups/data/mydata/mysql8
    
    cat> config/my.cnf <<-EOF
    [mysqld]
    basedir                     = /ups/app/mysql/mysql8
    datadir                     = /ups/data/mydata/mysql8
    log-error                   = /ups/app/mysql/mysql8/logs/mysql6033.err
    pid-file                    = /ups/app/mysql/mysql8/logs/mysql6033.pid
    socket                      = /ups/app/mysql/mysql8/logs/mysql6033.sock
    port                        = 6033
    default-storage-engine      = INNODB
    character-set-server        = utf8mb4
    collation-server            = utf8mb4_general_ci
    
    # connect limits
    max_connect_errors          = 5
    max_connections             = 1000
    max_user_connections        = 100
    wait_timeout                = 100
    
    open_files_limit            = 1024
    
    # 限制将系统文件读到数据库(/etc/passwd)
    local-infile                = 0
    
    skip_name_resolve           = ON
    
    server_id                   = 6033001
    
    # error log、genera log timestamp
    log_timestamps=SYSTEM
    
    # 在关闭是将热数据dump到本地磁盘
    innodb_buffer_pool_dump_at_shutdown = 1
    
    # 在启动时将热数据加载到内存
    innodb_buffer_pool_load_at_startup = 1
    EOF
    
    # 初始化MySQL
    /ups/app/mysql/mysql8/bin/mysqld --defaults-file=/ups/app/mysql/mysql8/config/my.cnf --user=mysql --basedir=/ups/app/mysql/mysql8 --datadir=/ups/data/mydata/mysql8 --initialize 
    
    # 启动服务
    /ups/app/mysql/mysql8/bin/mysqld_safe --defaults-file=/ups/app/mysql/mysql8/config/my.cnf &
    
    

    2. 配置账号

    # mysql8 默认使用caching_sha2_password算法
    # 修改root账号密码
    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
    # 远程登录
    create user root@'192.168.10.%' IDENTIFIED WITH mysql_native_password BY 'root' ;
    grant all privileges on *.* to 'root'@'192.168.10.%' with grant option;
    flush privileges;
    
    # 检查确认
    select host,user, authentication_string, plugin from mysql.user;
    
  • 相关阅读:
    遇见Javascript类型数组
    编译Android常用命令
    V4L2驱动视频开发要点
    Windows Phone开发(27):隔离存储A
    Ubuntu10.04下Android开发环境搭建
    V4L2开发要点
    使用 php Header 报错的一个原因
    Windows Phone开发(28):隔离存储B
    用HTML5 Audio API开发游戏音乐
    php备份数据库类分享
  • 原文地址:https://www.cnblogs.com/binliubiao/p/12586651.html
Copyright © 2020-2023  润新知