install mysql (precompiled)

tar -xvf mysql-8.0.22-linux-glibc2.12-x86_64.tar.xz
mkdir /mysql
mv mysql-8.0.22-linux-glibc2.12-x86_64/* /mysql

 

groupadd mysql
useradd -r -g mysql -s /bin/false mysql

 

mkdir /mysql
mkdir -p /data/{mysqldata,binlog,log,relaylog}
touch /data/log/mysqld.err
chown -R mysql:mysql /data

 

rm -rf /data/mysqldata/*
cd /mysql/bin
./mysqld --defaults-file=/etc/my.cnf --initialize --user=mysql --basedir=/mysql --datadir=/data/mysqldata 

ln -s /mysql/bin/{mysql,mysqldump,mysqladmin} /usr/bin/

 

cp /mysql/support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
systemctl enable mysqld
service mysqld start

 

 

my.cnf


[client]
user=root
password=P@ssW0rd
socket=/data/binlog/mysql.sock


[mysqld]
# basic settings #
user = mysql
port= 3306
server-id = 10001
basedir = /mysql
datadir = /data/mysqldata
socket=/data/binlog/mysql.sock
innodb_buffer_pool_size = 5G
autocommit = 1
mysql_native_password=ON
character_set_server=utf8
log_timestamps = SYSTEM
collation_server=utf8_general_ci
transaction_isolation = READ-COMMITTED
max_allowed_packet = 32M
skip-grant-tables = 1
lower_case_table_names = 1



# connection #
interactive_timeout = 28800
wait_timeout = 28800
#lock_wait_timeout = 1800
skip_name_resolve = 1
max_connections = 1000
max_connect_errors = 10000


# session memory settings #
read_buffer_size = 16M
read_rnd_buffer_size = 32M
sort_buffer_size = 32M
tmp_table_size = 64M
join_buffer_size = 128M
thread_cache_size = 64


# log settings #
#expire_logs_days = 7
binlog_expire_logs_seconds = 604800
max_binlog_size=200M
log-bin = /data/binlog/mysql-bin
log-bin-index = /data/binlog/mysql-bin-index
binlog-rows-query-log-events = 1
log-bin-trust-function-creators = 1
log-slave-updates = 1


# slow log settings #
slow_query_log = on
long_query_time = 1
min_examined_row_limit = 5000
log_slow_admin_statements = on
slow_query_log_file = /data/log/slow_query.log


# replication settings #
gtid_mode = on
enforce_gtid_consistency = on
log_slave_updates
binlog_format = ROW
binlog_rows_query_log_events = 1
relay_log = /data/relaylog/slave-relay.log


# parallel replication #
slave-parallel-type=LOGICAL_CLOCK
slave-parallel-workers=4
slave_preserve_commit_order=1


[mysqld_safe]
log-error=/data/log/mysqld.err
pid-file=/data/log/mysqld.pid



 

 
posted @ 2021-02-05 16:47  sam_wang10  阅读(88)  评论(0编辑  收藏  举报