centos7安装、卸载mysql8.0及source导入文件问题

使用rpm卸载、安装MYSQL8.0及使用source命令导入大SQL文件很慢的问题!

安装参考

MYSQL8.0 安装

  1. 上传MYSQL8.0.23安装包到 /usr/local/mysql下,该目录不存在,创建。

    centos7安装、卸载mysql8.0及source导入文件问题_第1张图片

  2. 解压MYSQL8.0.23
    tar -xvf mysql-8.0.23-1.el7.x86_64.rpm-bundle.tar
    解压结果如下:
    centos7安装、卸载mysql8.0及source导入文件问题_第2张图片

  3. 执行rpm安装

    rpm包有依赖关系,需要顺序安装!

     rpm -ivh mysql-community-common-8.0.23-1.el7.x86_64.rpm --nodeps --force
     rpm -ivh mysql-community-libs-8.0.23-1.el7.x86_64.rpm --nodeps --force
     rpm -ivh mysql-community-client-8.0.23-1.el7.x86_64.rpm --nodeps --force
     rpm -ivh mysql-community-server-8.0.23-1.el7.x86_64.rpm --nodeps --force
    
  4. 检查是否安装成功

     rpm -qa | grep mysql
    

    centos7安装、卸载mysql8.0及source导入文件问题_第3张图片

  5. 初始化

    mysqld --initialize
    
  6. 文件目录授权

    cd /var/lib/mysql
    chmod 777 ibdata1
    

    centos7安装、卸载mysql8.0及source导入文件问题_第4张图片

     chown mysql:mysql /var/lib/mysql/*
    

    centos7安装、卸载mysql8.0及source导入文件问题_第5张图片

  7. 启动并登录

    启动:service mysqld start
    查看状态:service mysqld status
    停止:service mysqld stop
    查看初始化密码:cat /var/log/mysqld.log | grep password

    mysql -u root -p初始化密码
    

    修改初始化密码

     alter user "root"@"localhost" identified by "密码";
    

    创建新用户并授权远程访问

        create user 'account'@'%' identified with mysql_native_password by '密码';    
    	grant all privileges on *.* to 'account'@'%' with grant option;
    	flush privileges;
    

MYSQL8.0.23 卸载

  1. 查看是否安装

    rpm -qa| grep mysql
    

    centos7安装、卸载mysql8.0及source导入文件问题_第6张图片

  2. 停止服务
    service mysqld stop

  3. 删除

    rpm -e --nodeps mysql-community-client-8.0.23-1.el7.x86_64
    ....
    
  4. 查看MYSQL目录

    fina / -name mysql
    

    查询除目录文件。删除!
    删除 /etc/my.cnf 文件

MYSQL8.0.23 my.cnf 配置 source 慢问题,作此记录

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove the leading "# " to disable binary logging
# Binary logging captures changes between backups and is enabled by
# default. It's default setting is log_bin=binlog
# disable_log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#
# Remove leading # to revert to previous value for default_authentication_plugin,
# this will increase compatibility with older clients. For background, see:
# https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
# default-authentication-plugin=mysql_native_password

datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

lower_case_table_names=2
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
performance_schema_max_table_instances = 400
table_definition_cache = 400
skip-external-locking
key_buffer_size = 1024M
max_allowed_packet = 100G
table_open_cache = 4096
sort_buffer_size = 16M
net_buffer_length = 4K
read_buffer_size = 16M
read_rnd_buffer_size = 256K
myisam_sort_buffer_size = 256M
thread_cache_size = 512
tmp_table_size = 512M
default_authentication_plugin = mysql_native_password
wait_timeout=315360000
interactive_timeout=315360000

explicit_defaults_for_timestamp = true
#skip-name-resolve
max_connections = 500
max_connect_errors = 100
open_files_limit = 65535

innodb_buffer_pool_size = 4096M
innodb_log_file_size = 2048M
innodb_log_buffer_size = 512M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
innodb_max_dirty_pages_pct = 90
innodb_read_io_threads = 24
innodb_write_io_threads = 24
secure_file_priv=''

[mysqldump]
quick
max_allowed_packet = 500M

[mysql]
no-auto-rehash

[myisamchk]
key_buffer_size = 1024M
sort_buffer_size = 16M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout

你可能感兴趣的:(Java,数据库,mysql,数据库,java)