Galaxy Kylin 4.0.2 binary install mysql5.7

First check the version of Galaxy Kylin
root@idiom-kylin1:~# cat /etc/kylin-build
Kylin 4.0.2
Build 20191024
1. Download the binary package and install the required software
root@idiom-kylin3:/usr/local# wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.30-linux-glibc2.12-x86_64.tar.gz --no-check-certificate
root@idiom-kylin3:/usr /local/mysql/bin# apt-get install libnuma* libaio* numactl openssl
2. New users, directories, and authorization
root@idiom-kylin1:/usr/local# groupadd mysql
root@idiom-kylin1:/usr/local# useradd -r -g mysql -s /bin/false mysql
root@idiom-kylin1:/usr/local# tar zxvf mysql-5.7.30-linux-glibc2.12-x86_64.tar.gz
root @idiom-kylin1:/usr/local# mv mysql-5.7.30-linux-glibc2.12-x86_64 mysql
root@idiom-kylin1:/usr/local# cd mysql
root@idiom-kylin1:/usr/local/mysql# mkdir -p /data/mysql/{data,,log,,mysqltmp,,redolog,,undolog} && touch /data/mysql/log/mysql_run.err && chown mysql:mysql -R /data/mysql /usr/local/mysql
3. Initial installation of mysql
root@idiom-kylin1: /usr/local/mysql# bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/data
2020-10-20T02 :03:07.193878Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-10-20T02:03:07.364788Z 0 [Warning] InnoDB: New log files created, LSN=45790
2020-10-20T02:03:07.396768Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2020-10 -20T02:03:07.458470Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 65953313-1278-11eb-8814-000c297f724b.
2020 -10-20T02:03:07.462033Z 0 [Warning] Gtid table is not ready to be used. Table'mysql.gtid_executed' cannot be opened.
2020-10-20T02:03:08.466026Z 0 [Warning] CA certificate ca. pem is self signed.
2020-10-20T02:03:08.744577Z 1 [Note] A temporary password is generated for root@localhost: ow)qy*ND2n_r
##If you want to deploy a server that automatically supports secure connections, use the mysql_ssl_rsa_setup utility Create default SSL and RSA files
root@idiom-kylin1: /usr/local/mysql# bin/mysql_ssl_rsa_setup --datadir=/data/mysql/data
Fourth, edit the my.cnf configuration file
root@idiom-kylin1:/usr/local/mysql#vi /etc/my.cnf

prompt = '\u@\h [\d]> '
no-auto-rehash
[client]
port    = 3306
socket  = /usr/local/mysql/mysql.sock
default-character-set = utf8mb4

[mysqld]
########basic settings########
server-id = 2886738311
port = 3306
user = mysql
socket  = /usr/local/mysql/mysql.sock
basedir         = /usr/local/mysql
datadir         = /data/mysql/data
tmpdir          = /data/mysql/mysqltmp
log-error       = /data/mysql/log/mysql_run.err
pid-file        = /data/mysql/pid_mysql.pid
autocommit = 1
back_log = 1024
bind-address = 172.16.20.157
init-connect = 'SET NAMES utf8mb4'
character_set_server=utf8mb4
skip_name_resolve = 1
max_connections = 3000
max_connect_errors = 5000
transaction_isolation = REPEATABLE-READ
explicit_defaults_for_timestamp = 1
join_buffer_size = 128M
lower_case_table_names = 1
tmp_table_size = 1024M
tmpdir = /data/mysql/mysqltmp
default_storage_engine = INNODB
max_allowed_packet = 512M
sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER"
#interactive_timeout = 1800
#wait_timeout = 1800
read_buffer_size = 16777216
read_rnd_buffer_size = 33554432
sort_buffer_size = 33554432
log_bin_trust_function_creators = 1
max_heap_table_size = 1024M 
secure_file_priv="/"
########log settings########
slow_query_log = 1
slow_query_log_file = /data/mysql/log/mysql_slow.log
#log_queries_not_using_indexes = 1
log_slow_admin_statements = 1
log_slow_slave_statements = 1
log_throttle_queries_not_using_indexes = 10
expire_logs_days = 15
long_query_time = 1
min_examined_row_limit = 100
########replication settings########
master_info_repository = TABLE
relay_log_info_repository = TABLE
log-bin = /data/mysql/log/mysql-bin.log
log-bin-index = mysql-bin.index
sync_binlog = 1
gtid_mode = on
enforce_gtid_consistency = 1
log_slave_updates
binlog_format = row
relay-log = /data/mysql/log/mysql-relay.log
relay-log-index = mysql-relay.index
relay_log_recovery = 1
binlog_gtid_simple_recovery = 1
########innodb settings########
#innodb_buffer_pool_size = 16384M
#整个宿主机是32G ,所以一半是16G ,这里用16乘以1024换算为16348M
innodb_buffer_pool_instances = 8
innodb_buffer_pool_load_at_startup = 1
innodb_buffer_pool_dump_at_shutdown = 1
innodb_lru_scan_depth = 4000
innodb_flush_log_at_trx_commit = 2
innodb_lock_wait_timeout = 10
innodb_io_capacity = 5000
innodb_io_capacity_max = 12000
innodb_write_io_threads = 16
innodb_read_io_threads = 16
innodb_flush_method = O_DIRECT
innodb_data_home_dir = /data/mysql/data
innodb_data_file_path = ibdata1:1024M:autoextend
innodb_log_group_home_dir = /data/mysql/redolog/
innodb_log_file_size = 2G
innodb_log_files_in_group = 3
innodb_log_buffer_size = 32M
innodb_undo_directory = /data/mysql/undolog/
innodb_undo_logs = 128
innodb_undo_tablespaces = 3
innodb_max_undo_log_size = 2G
innodb_undo_log_truncate = 1
innodb_flush_neighbors = 1
innodb_purge_threads = 4
innodb_large_prefix = 1
innodb_thread_concurrency = 64
innodb_print_all_deadlocks = 1
innodb_strict_mode = 1
innodb_sort_buffer_size = 67108864
innodb_file_per_table = 1
innodb_max_dirty_pages_pct = 50
innodb_buffer_pool_dump_pct = 40
innodb_page_cleaners = 4
innodb_purge_rseg_truncate_frequency = 128
group_concat_max_len = 10000
########semi sync replication settings########
plugin_dir=/usr/local/mysql/lib/plugin
plugin_load = "rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so"
loose_rpl_semi_sync_master_enabled = 1
loose_rpl_semi_sync_slave_enabled = 1
loose_rpl_semi_sync_master_timeout = 5000
binlog_gtid_simple_recovery=1
log_timestamps=system
transaction_write_set_extraction=MURMUR32
show_compatibility_56=on
#slave-parallel-type=LOGICAL_CLOCK
#slave-parallel-workers=16

[mysqldump]
quick
max_allowed_packet = 512M

[mysqld_safe]
open-files-limit = 65536

#note. The my.cnf file has several parameters that need to be modified according to the system configuration
#innodb_buffer_pool_size Half of the host memory multiplied by 1024 is converted to xxxM
#innodb_undo_tablespaces
#innodb_data_file_path Calculation method: size value pages*16K/page/1024K/M = 12M
#bind- address is changed to the local IP

Fifth, start the service, and to publish mysql environment variable
root @ idiom-kylin1: / usr / local / mysql # /usr/local/mysql/bin/mysqld_safe --user=mysql --datadir=/data/mysql/data --pid-file=/data/mysql/pid_mysql.pid &
root @ idiom-kylin1: / usr / local / mysql # echo "export PATH=$PATH:/usr/local/mysql/bin" >>/etc/profile
root @ idiom-kylin1: / usr / local / mysql # source /etc/profile
six , Modify the root password
root@idiom-kylin1:/usr/local/mysql# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with; or \g.
Your MySQL connection id is 2
Server version: 5.7.30-log

Copyright © 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

root@localhost [(none)]> ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘chenyu0830’;
Query OK, 0 rows affected (5.02 sec)

root@localhost [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

注意:如果需要重启服务,使用以下命令
root@idiom-kylin1:/usr/local/mysql# ps -aux |grep mysql
root 29068 0.0 0.1 4664 1912 pts/0 S 11:26 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql/data --pid-file=/data/mysql/pid_mysql.pid
mysql 30365 0.1 18.8 1375848 187576 pts/0 Sl 11:26 0:01 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/log/mysql_run.err --open-files-limit=65536 --pid-file=/data/mysql/pid_mysql.pid --socket=/usr/local/mysql/mysql.sock --port=3306
root 30590 0.0 0.0 16188 980 pts/0 S+ 11:43 0:00 grep --color=auto mysql
root@idiom-kylin1:/usr/local/mysql# /usr/local/mysql/support-files/mysql.server stop
Shutting down MySQL
… *
root@idiom-kylin1:/usr/local/mysql# /usr/local/mysql/support-files/mysql.server start
Starting MySQL
. *
root@idiom-kylin1:/usr/local/mysql#ps -aux |grep mysql
root 30638 0.5 0.1 4664 1728 pts/0 S 11:43 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql/data --pid-file=/data/mysql/pid_mysql.pid
mysql 31935 9.0 18.8 1375848 187592 pts/0 Sl 11:43 0:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/log/mysql_run.err --open-files-limit=65536 --pid-file=/data/mysql/pid_mysql.pid --socket=/usr/local/mysql/mysql.sock --port=3306

Guess you like

Origin blog.csdn.net/cyhelloyes/article/details/109216908