MySQL 5.7.20 二进制编译安装

安装脚本内容如下

cat install_mysql.sh

#!/bin/bash
rpm -qa | grep mariadb-libs | xargs rpm -e --nodeps &> /dev/null
rpm -qa|grep mysql | xargs rpm -e --nodeps
rm -rf /usr/local/mysql
\cp -rf /root/my.cnf /etc
userdel mysql
groupadd mysql
useradd -r -g mysql -s /sbin/nologin mysql
tar -xf /usr/local/src/mysql-5.7.20-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
cd /usr/local
mv mysql-5.7.20-linux-glibc2.12-x86_64 mysql
cd mysql
mkdir mysql-files
mkdir log
mkdir data
chmod 750 mysql-files
chown -R mysql:mysql /usr/local/mysql
bin/mysqld --initialize-insecure --user=mysql  --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
bin/mysql_ssl_rsa_setup --datadir=/usr/local/mysql/data
chown -R mysql:mysql /usr/local/mysql/*
\cp -rf /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
service mysqld start
echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile

my.cnf 文件

[client]
port=3306
socket=/usr/local/mysql/mysql.sock
default-character-set=utf8mb4

[mysql]
auto-rehash

[mysqld]
user = mysql
port = 3306
character-set-server = utf8
datadir = /usr/local/mysql/data
basedir = /usr/local/mysql
socket = /usr/local/mysql/mysql.sock
default-storage-engine=InnoDB
log-error = /usr/local/mysql/log/error.log
pid-file = /usr/local/mysql/mysqld.pid
federated
server-id = 1
log_bin = /usr/local/mysql/log/binlog
max_binlog_size = 1024M
binlog_cache_size = 4M
max_binlog_cache_size = 8G
binlog_format=row
#expire_logs_days = 90
#log_bin_trust_function_creators=1
general_log = 0
general_log_file = /usr/local/mysql/log/general.log
slow_query_log=1
slow_query_log_file=/usr/local/mysql/log/mysql-slow.log
long_query_time=5
log_queries_not_using_indexes=1
binlog_rows_query_log_events=1
external-locking = FALSE
skip-external-locking
max_connections = 512
connect_timeout = 10
wait_timeout = 6000
interactive_timeout = 6000
max_connect_errors = 100
key_buffer_size = 32M
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
thread_cache_size = 51
table_open_cache = 2048
query_cache_size = 32M
tmp_table_size = 96M
max_heap_table_size = 96M
#sync_binlog = 1
lower_case_table_names = 1
explicit_defaults_for_timestamp = true
log_timestamps = system
skip-host-cache
skip-name-resolve
skip-ssl
transaction_isolation = REPEATABLE-READ
innodb_buffer_pool_size = 24576M
innodb_data_file_path = ibdata1:1024M:autoextend
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 16M
innodb_log_file_size = 256M
innodb_log_files_in_group = 2
innodb_max_dirty_pages_pct = 50
innodb_file_per_table = 1
innodb_locks_unsafe_for_binlog = 0
innodb_buffer_pool_load_at_startup=1
innodb_buffer_pool_dump_at_shutdown=1
innodb_print_all_deadlocks = 1
innodb_lock_wait_timeout = 30
innodb_read_io_threads = 2
innodb_io_capacity = 200
innodb_thread_concurrency = 2
[mysqldump]
quick
max_allowed_packet = 64M

mysql下载地址

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值