zoukankan      html  css  js  c++  java
  • 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;
    
  • 相关阅读:
    cenos7 安装samba
    Cenos7 学习笔记
    mysql学习笔记(一)
    Qt 程序打包发布总结 转
    主机名由localhost变成bogon是怎么回事,怎样变回localhost这个名字?
    Heap Size 与 Stack Size
    数据字节对齐案例
    C语言进阶日志二
    位带操作
    Stm32高级定时器(转自:luowei_memory)
  • 原文地址:https://www.cnblogs.com/binliubiao/p/12586651.html
Copyright © 2011-2022 走看看