• Linux安装MySQL8.0.12之二进制安装


    运行环境:centos 7.5 + mysql8.0.12

    1.下载官方打包好的二进制安装包:

    wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.12-linux-glibc2.12-x86_64.tar.xz

    2.解压文件:

    tar -xJvf mysql-8.0.12-linux-glibc2.12-x86_64.tar.xz -C /usr/local/
    mv /usr/local/mysql-8.0.12-linux-glibc2.12-x86_64/ /usr/local/mysql

    3.创建目录授权

    groupadd mysql
    useradd mysql
    
    mkdir -p /usr/local/mysql/
    mkdir -p /usr/local/mysql/data
    mkdir -p /usr/local/mysql/etc
    mkdir -p /usr/local/mysql/log
    
    chown -R mysql:mysql /usr/local/mysql/

    4.配置参数文件:

    cat > /usr/local/mysql/etc/my.cnf << EOF
    [client]
    port                           = 3306
    socket                         = /usr/local/mysql/data/mysql.sock
    [mysqld]
    server-id                      = 1
    port                           = 3306
    mysqlx_port                    = 33060
    mysqlx_socket                  = /usr/local/mysql/data/mysqlx.sock
    datadir                        = /usr/local/mysql/data
    socket                         = /usr/local/mysql/data/mysql.sock
    pid-file                       = /usr/local/mysql/data/mysqld.pid
    log-error                      = error.log
    slow-query-log                 = 1
    slow-query-log-file            = slow.log
    long_query_time                = 0.2
    log-bin                        = bin.log
    relay-log                      = relay.log
    binlog_format                 =ROW
    relay_log_recovery            = 1
    character-set-client-handshake = FALSE
    character-set-server           = utf8mb4
    collation-server               = utf8mb4_unicode_ci
    init_connect                   ='SET NAMES utf8mb4'
    innodb_buffer_pool_size        = 1G
    join_buffer_size               = 128M
    sort_buffer_size               = 2M
    read_rnd_buffer_size           = 2M
    log_timestamps                 = SYSTEM
    lower_case_table_names         = 1
    default-authentication-plugin  =mysql_native_password
    
    EOF

    5.初始化数据库:

    /usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql 
    cat /usr/local/mysql/data/error.log | grep -i password

    6.设置启动文件和环境变量:

    cp /usr/local/mysql/support-files/mysql.server  /etc/init.d/mysql
    chkconfig --add mysql
    chkconfig --list
    systemctl start mysql

    7.设置可以远程登录的账号:

    mysql> show variables like '%valid%pass%';
    Empty set (0.00 sec)
    mysql> create user root@'%' identified by 'abc123';
    ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
    mysql> show variables like '%valid%pass%';
    ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
    mysql> alter user root@'localhost' identified by 'abc123';
    Query OK, 0 rows affected (0.07 sec)
    mysql> show variables like '%valid%pass%';
    Empty set (0.01 sec)
    --创建可以远程登录的用户:
    mysql> create user root@'%' identified by 'abc123';
    Query OK, 0 rows affected (0.06 sec)
    mysql> grant all privileges on *.* to root@'%' with grant option;
    Query OK, 0 rows affected (0.07 sec)
    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)
  • 相关阅读:
    java发送http的get、post请求
    spring boot注解 --@EnableAsync 异步调用
    java代码将e.printStackTrace()写入log4j文件异常信息
    Mybatis 传入List类型参数,报错:There is no getter for property named '__frch_item_0' in
    mongodb 只查询一个字段
    如何在java List中进行模糊查询
    java操作Mongodb
    java操作mongodb时,对象bean和DBObject相互转换的方法
    java 字符串,字符数组,list间的转化
    ldconfig 让安装的 php 的rdkafka生效
  • 原文地址:https://www.cnblogs.com/EikiXu/p/9831425.html
Copyright © 2020-2023  润新知