1. 程式人生 > 遊戲 >MOD小組計劃復刻《指環王:征服》 幾乎全盤重做

MOD小組計劃復刻《指環王:征服》 幾乎全盤重做

原始碼包安裝Mysql

前期準備

mkdir /usr/local/src/mysql5.7.10-glibc
cd /usr/local/src/mysql5.7.10-glibc
#下載mysql包
wget https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-5.7.34-linux-glibc2.12-x86_64.tar.gz
#vim my.cnf
[client]
port = 3306
socket = /tmp/mysql.sock

[mysqld]
lower_case_table_names = 1
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
character_set_server=utf8
port = 3306
socket = /tmp/mysql.sock
datadir = /home/mysqldata
ft_min_word_len = 1
slow_query_log = 1
slow_query_log_file = /home/mysqldata/mysqlslow.log
long_query_time = 1
skip-external-locking
back_log = 600
max_connections = 3000
max_connect_errors = 1000000
table_open_cache = 1024
max_allowed_packet = 32M
binlog_cache_size = 4M
max_heap_table_size = 256M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
sort_buffer_size = 16M
join_buffer_size = 16M
thread_cache_size = 300
query_cache_type = Off
query_cache_size = 0
query_cache_limit = 8M
ft_min_word_len = 8
default-storage-engine = INNODB
thread_stack = 192K
transaction_isolation = REPEATABLE-READ
tmp_table_size = 256M
sync_binlog = 0 
expire_logs_days = 5
binlog_format=mixed
key_buffer_size = 32M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 5G
myisam_repair_threads = 1
log_timestamps=SYSTEM
local-infile=0

#replication  
server_id=1
binlog-ignore-db=mysql  
log-bin=/home/mysqlbinloginfo/master-mysql-bin  
max_binlog_size = 100M
max_binlog_cache_size = 2G
innodb_buffer_pool_size = 4G
innodb_data_file_path = ibdata1:10M:autoextend
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 16M
innodb_log_file_size = 256M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_file_per_table = On

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
auto-rehash

[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 8M
write_buffer = 8M

[mysqlhotcopy]
interactive-timeout

[mysqld_safe]
open-files-limit = 8192

開始安裝

關閉防火牆

systemctl stop firewalld
setenforce 0

建立使用者

groupadd mysql && useradd -M -g mysql -s /sbin/nologin mysql

安裝依賴

yum install -y libaio.x86_64

刪除已存在檔案

mv /etc/my.cnf /etc/my.cnf.bak

建立資料存放資料夾

mkdir /home/mysqldata && mkdir /home/mysqlbinloginfo

拷貝檔案

cd /usr/local/src/mysql5.7.10-glibc && cp -f /usr/local/src/mysql5.7.10-glibc/my.cnf /etc/my.cnf

解壓

tar -xvf mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz -C /usr/local && mv /usr/local/mysql-5.7.10-linux-glibc2.5-x86_64 /usr/local/mysql

授權檔案許可權

chown -R mysql:mysql /usr/local/mysql/* /home/mysqldata /home/mysqlbinloginfo && chmod -R 755 /home/mysqldata

安裝

cd /usr/local/mysql/bin && ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/home/mysqldata

拷貝啟動檔案

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld && sed -i '47 c\datadir=/home/mysqldata' /etc/init.d/mysqld

新增環境變數

echo -e "export PATH=/usr/local/mysql/bin:\$PATH" > /etc/profile.d/mysql.sh

設定自啟

chkconfig --add mysqld && chkconfig mysqld on && systemctl start mysqld

檢視初始密碼

mima=`cat /root/.mysql_secret | sed -n '2p'`

設定新密碼

mysqlpw=*hy7uBHf6

生效系統檔案

source /etc/profile

修改初始密碼(按要求必須修改初始密碼)

mysql -uroot -p$mima --connect-expired-password -e "alter user 'root'@'localhost' identified by '${mysqlpw}';flush privileges;"