mirror of https://github.com/midoks/mdserver-web
parent
8c9bfd7e2d
commit
e45b9b4101
@ -0,0 +1,4 @@ |
|||||||
|
[mysqld] |
||||||
|
# SHOW GLOBAL VARIABLES LIKE '%gtid%' |
||||||
|
gtid_mode=ON |
||||||
|
enforce_gtid_consistency=ON |
@ -0,0 +1,110 @@ |
|||||||
|
[client] |
||||||
|
user = root |
||||||
|
#password = your_password |
||||||
|
port = 33206 |
||||||
|
socket = {$SERVER_APP_PATH}/mysql.sock |
||||||
|
default-character-set = UTF8MB4 |
||||||
|
|
||||||
|
[mysqld] |
||||||
|
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf |
||||||
|
|
||||||
|
pid-file = {$SERVER_APP_PATH}/data/mysql.pid |
||||||
|
user = mysql |
||||||
|
port = 33206 |
||||||
|
socket = {$SERVER_APP_PATH}/mysql.sock |
||||||
|
datadir = {$SERVER_APP_PATH}/data |
||||||
|
log-error = {$SERVER_APP_PATH}/data/error.log |
||||||
|
server-id = {$SERVER_ID} |
||||||
|
sql-mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES |
||||||
|
|
||||||
|
default_storage_engine = InnoDB |
||||||
|
language={$SERVER_APP_PATH}/bin/usr/share/mysql/english |
||||||
|
|
||||||
|
key_buffer_size = 8M |
||||||
|
table_open_cache = 32 |
||||||
|
sort_buffer_size = 256K |
||||||
|
net_buffer_length = 4K |
||||||
|
read_buffer_size = 128K |
||||||
|
read_rnd_buffer_size = 256K |
||||||
|
myisam_sort_buffer_size = 4M |
||||||
|
thread_cache_size = 4 |
||||||
|
lower_case_table_names=0 |
||||||
|
character-set-server = UTF8MB4 |
||||||
|
|
||||||
|
query_cache_type = 1 |
||||||
|
query_cache_size = 64M |
||||||
|
|
||||||
|
max_connections = 500 |
||||||
|
max_connect_errors = 100 |
||||||
|
open_files_limit = 2560 |
||||||
|
max_allowed_packet = 128M |
||||||
|
|
||||||
|
skip_name_resolve = 1 |
||||||
|
skip-ssl |
||||||
|
#skip-networking |
||||||
|
#skip-external-locking |
||||||
|
#loose-skip-innodb |
||||||
|
#skip-grant-tables |
||||||
|
|
||||||
|
log-bin=mysql-bin |
||||||
|
binlog_format=mixed |
||||||
|
slow_query_log=1 |
||||||
|
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log |
||||||
|
long_query_time=3 |
||||||
|
expire_logs_days=30 |
||||||
|
#log_queries_not_using_indexes=on |
||||||
|
|
||||||
|
relay-log=mdserver |
||||||
|
relay-log-index=mdserver |
||||||
|
|
||||||
|
#master |
||||||
|
#sync_binlog=1 |
||||||
|
|
||||||
|
#binlog-do-db |
||||||
|
binlog-ignore-db = test |
||||||
|
binlog-ignore-db = mysql |
||||||
|
binlog-ignore-db = information_schema |
||||||
|
binlog-ignore-db = performance_schema |
||||||
|
|
||||||
|
#slave |
||||||
|
log-slave-updates |
||||||
|
#replicate-do-db |
||||||
|
slave_skip_errors=1062,1396 |
||||||
|
replicate-ignore-db = information_schema |
||||||
|
replicate-ignore-db = performance_schema |
||||||
|
replicate-ignore-db = mysql |
||||||
|
replicate-ignore-db = test |
||||||
|
|
||||||
|
master_info_repository = table |
||||||
|
relay_log_info_repository = table |
||||||
|
|
||||||
|
default_storage_engine = InnoDB |
||||||
|
innodb_data_home_dir = {$SERVER_APP_PATH}/data |
||||||
|
innodb_data_file_path = ibdata1:10M:autoextend |
||||||
|
innodb_log_group_home_dir = {$SERVER_APP_PATH}/data |
||||||
|
innodb_buffer_pool_size = 16M |
||||||
|
innodb_log_file_size = 5M |
||||||
|
innodb_log_buffer_size = 8M |
||||||
|
innodb_flush_log_at_trx_commit = 1 |
||||||
|
innodb_lock_wait_timeout = 120 |
||||||
|
innodb_max_dirty_pages_pct = 90 |
||||||
|
innodb_read_io_threads = 1 |
||||||
|
innodb_write_io_threads = 1 |
||||||
|
innodb_file_per_table=1 |
||||||
|
|
||||||
|
secure-file-priv={$SERVER_APP_PATH}/tmp |
||||||
|
|
||||||
|
[mysqldump] |
||||||
|
quick |
||||||
|
|
||||||
|
[mysql] |
||||||
|
no-auto-rehash |
||||||
|
|
||||||
|
[myisamchk] |
||||||
|
key_buffer_size = 20M |
||||||
|
sort_buffer_size = 20M |
||||||
|
read_buffer = 2M |
||||||
|
write_buffer = 2M |
||||||
|
|
||||||
|
[mysqlhotcopy] |
||||||
|
interactive-timeout |
@ -0,0 +1,103 @@ |
|||||||
|
[client] |
||||||
|
user = root |
||||||
|
#password = your_password |
||||||
|
port = 33206 |
||||||
|
socket = {$SERVER_APP_PATH}/mysql.sock |
||||||
|
default-character-set = UTF8MB4 |
||||||
|
|
||||||
|
[mysqld] |
||||||
|
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf |
||||||
|
|
||||||
|
authentication_policy=mysql_native_password |
||||||
|
pid-file = {$SERVER_APP_PATH}/data/mysql.pid |
||||||
|
user = mysql |
||||||
|
port = 33206 |
||||||
|
mysqlx_port = 33260 |
||||||
|
socket = {$SERVER_APP_PATH}/mysql.sock |
||||||
|
datadir = {$SERVER_APP_PATH}/data |
||||||
|
log-error = {$SERVER_APP_PATH}/data/error.log |
||||||
|
server-id = {$SERVER_ID} |
||||||
|
|
||||||
|
default_storage_engine = InnoDB |
||||||
|
|
||||||
|
key_buffer_size = 8M |
||||||
|
table_open_cache = 32 |
||||||
|
sort_buffer_size = 256K |
||||||
|
net_buffer_length = 4K |
||||||
|
read_buffer_size = 128K |
||||||
|
read_rnd_buffer_size = 256K |
||||||
|
myisam_sort_buffer_size = 4M |
||||||
|
thread_cache_size = 4 |
||||||
|
lower_case_table_names=1 |
||||||
|
tmp_table_size = 8M |
||||||
|
character-set-server = UTF8MB4 |
||||||
|
|
||||||
|
max_connections = 500 |
||||||
|
max_connect_errors = 100 |
||||||
|
open_files_limit = 2560 |
||||||
|
max_allowed_packet = 128M |
||||||
|
|
||||||
|
#skip-external-locking |
||||||
|
#skip-grant-tables |
||||||
|
#loose-skip-innodb |
||||||
|
#skip-networking |
||||||
|
#skip-name-resolve |
||||||
|
|
||||||
|
log-bin=mysql-bin |
||||||
|
slow_query_log=1 |
||||||
|
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log |
||||||
|
long_query_time=3 |
||||||
|
#log_queries_not_using_indexes=on |
||||||
|
|
||||||
|
relay-log=mdserver |
||||||
|
relay-log-index=mdserver |
||||||
|
|
||||||
|
#master |
||||||
|
#sync_binlog=1 |
||||||
|
|
||||||
|
#binlog-do-db |
||||||
|
binlog-ignore-db = test |
||||||
|
binlog-ignore-db = mysql |
||||||
|
binlog-ignore-db = information_schema |
||||||
|
binlog-ignore-db = performance_schema |
||||||
|
|
||||||
|
#slave |
||||||
|
log_replica_updates |
||||||
|
#replicate-do-db |
||||||
|
replica_skip_errors=1062,1396 |
||||||
|
replicate-ignore-db = information_schema |
||||||
|
replicate-ignore-db = performance_schema |
||||||
|
replicate-ignore-db = mysql |
||||||
|
replicate-ignore-db = test |
||||||
|
|
||||||
|
default_storage_engine = InnoDB |
||||||
|
innodb_data_home_dir = {$SERVER_APP_PATH}/data |
||||||
|
innodb_data_file_path = ibdata1:10M:autoextend |
||||||
|
innodb_log_group_home_dir = {$SERVER_APP_PATH}/data |
||||||
|
innodb_buffer_pool_size = 16M |
||||||
|
innodb_redo_log_capacity=10485760 |
||||||
|
innodb_log_buffer_size = 8M |
||||||
|
innodb_flush_log_at_trx_commit = 1 |
||||||
|
innodb_lock_wait_timeout = 120 |
||||||
|
innodb_max_dirty_pages_pct = 90 |
||||||
|
innodb_read_io_threads = 1 |
||||||
|
innodb_write_io_threads = 1 |
||||||
|
innodb_file_per_table=1 |
||||||
|
binlog_expire_logs_seconds=2592000 |
||||||
|
|
||||||
|
secure-file-priv={$SERVER_APP_PATH}/tmp |
||||||
|
|
||||||
|
[mysqldump] |
||||||
|
quick |
||||||
|
|
||||||
|
[mysql] |
||||||
|
no-auto-rehash |
||||||
|
|
||||||
|
[myisamchk] |
||||||
|
key_buffer_size = 20M |
||||||
|
sort_buffer_size = 20M |
||||||
|
read_buffer = 2M |
||||||
|
write_buffer = 2M |
||||||
|
|
||||||
|
[mysqlhotcopy] |
||||||
|
interactive-timeout |
@ -0,0 +1,103 @@ |
|||||||
|
[client] |
||||||
|
user = root |
||||||
|
#password = your_password |
||||||
|
port = 33206 |
||||||
|
socket = {$SERVER_APP_PATH}/mysql.sock |
||||||
|
default-character-set = UTF8MB4 |
||||||
|
|
||||||
|
[mysqld] |
||||||
|
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf |
||||||
|
|
||||||
|
authentication_policy=caching_sha2_password |
||||||
|
pid-file = {$SERVER_APP_PATH}/data/mysql.pid |
||||||
|
user = mysql |
||||||
|
port = 33206 |
||||||
|
mysqlx_port = 33260 |
||||||
|
socket = {$SERVER_APP_PATH}/mysql.sock |
||||||
|
datadir = {$SERVER_APP_PATH}/data |
||||||
|
log-error = {$SERVER_APP_PATH}/data/error.log |
||||||
|
server-id = {$SERVER_ID} |
||||||
|
|
||||||
|
default_storage_engine = InnoDB |
||||||
|
|
||||||
|
key_buffer_size = 8M |
||||||
|
table_open_cache = 32 |
||||||
|
sort_buffer_size = 256K |
||||||
|
net_buffer_length = 4K |
||||||
|
read_buffer_size = 128K |
||||||
|
read_rnd_buffer_size = 256K |
||||||
|
myisam_sort_buffer_size = 4M |
||||||
|
thread_cache_size = 4 |
||||||
|
lower_case_table_names=1 |
||||||
|
tmp_table_size = 8M |
||||||
|
character-set-server = UTF8MB4 |
||||||
|
|
||||||
|
max_connections = 500 |
||||||
|
max_connect_errors = 100 |
||||||
|
open_files_limit = 2560 |
||||||
|
max_allowed_packet = 128M |
||||||
|
|
||||||
|
#skip-external-locking |
||||||
|
#skip-grant-tables |
||||||
|
#loose-skip-innodb |
||||||
|
#skip-networking |
||||||
|
#skip-name-resolve |
||||||
|
|
||||||
|
log-bin=mysql-bin |
||||||
|
slow_query_log=1 |
||||||
|
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log |
||||||
|
long_query_time=3 |
||||||
|
#log_queries_not_using_indexes=on |
||||||
|
|
||||||
|
relay-log=mdserver |
||||||
|
relay-log-index=mdserver |
||||||
|
|
||||||
|
#master |
||||||
|
#sync_binlog=1 |
||||||
|
|
||||||
|
#binlog-do-db |
||||||
|
binlog-ignore-db = test |
||||||
|
binlog-ignore-db = mysql |
||||||
|
binlog-ignore-db = information_schema |
||||||
|
binlog-ignore-db = performance_schema |
||||||
|
|
||||||
|
#slave |
||||||
|
log_replica_updates |
||||||
|
#replicate-do-db |
||||||
|
replica_skip_errors=1062,1396 |
||||||
|
replicate-ignore-db = information_schema |
||||||
|
replicate-ignore-db = performance_schema |
||||||
|
replicate-ignore-db = mysql |
||||||
|
replicate-ignore-db = test |
||||||
|
|
||||||
|
default_storage_engine = InnoDB |
||||||
|
innodb_data_home_dir = {$SERVER_APP_PATH}/data |
||||||
|
innodb_data_file_path = ibdata1:10M:autoextend |
||||||
|
innodb_log_group_home_dir = {$SERVER_APP_PATH}/data |
||||||
|
innodb_buffer_pool_size = 16M |
||||||
|
innodb_redo_log_capacity=10485760 |
||||||
|
innodb_log_buffer_size = 8M |
||||||
|
innodb_flush_log_at_trx_commit = 1 |
||||||
|
innodb_lock_wait_timeout = 120 |
||||||
|
innodb_max_dirty_pages_pct = 90 |
||||||
|
innodb_read_io_threads = 1 |
||||||
|
innodb_write_io_threads = 1 |
||||||
|
innodb_file_per_table=1 |
||||||
|
binlog_expire_logs_seconds=2592000 |
||||||
|
|
||||||
|
secure-file-priv={$SERVER_APP_PATH}/tmp |
||||||
|
|
||||||
|
[mysqldump] |
||||||
|
quick |
||||||
|
|
||||||
|
[mysql] |
||||||
|
no-auto-rehash |
||||||
|
|
||||||
|
[myisamchk] |
||||||
|
key_buffer_size = 20M |
||||||
|
sort_buffer_size = 20M |
||||||
|
read_buffer = 2M |
||||||
|
write_buffer = 2M |
||||||
|
|
||||||
|
[mysqlhotcopy] |
||||||
|
interactive-timeout |
@ -0,0 +1,103 @@ |
|||||||
|
[client] |
||||||
|
user = root |
||||||
|
#password = your_password |
||||||
|
port = 33206 |
||||||
|
socket = {$SERVER_APP_PATH}/mysql.sock |
||||||
|
default-character-set = UTF8MB4 |
||||||
|
|
||||||
|
[mysqld] |
||||||
|
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf |
||||||
|
|
||||||
|
authentication_policy=caching_sha2_password |
||||||
|
pid-file = {$SERVER_APP_PATH}/data/mysql.pid |
||||||
|
user = mysql |
||||||
|
port = 33206 |
||||||
|
mysqlx_port = 33260 |
||||||
|
socket = {$SERVER_APP_PATH}/mysql.sock |
||||||
|
datadir = {$SERVER_APP_PATH}/data |
||||||
|
log-error = {$SERVER_APP_PATH}/data/error.log |
||||||
|
server-id = {$SERVER_ID} |
||||||
|
|
||||||
|
default_storage_engine = InnoDB |
||||||
|
|
||||||
|
key_buffer_size = 8M |
||||||
|
table_open_cache = 32 |
||||||
|
sort_buffer_size = 256K |
||||||
|
net_buffer_length = 4K |
||||||
|
read_buffer_size = 128K |
||||||
|
read_rnd_buffer_size = 256K |
||||||
|
myisam_sort_buffer_size = 4M |
||||||
|
thread_cache_size = 4 |
||||||
|
lower_case_table_names=1 |
||||||
|
tmp_table_size = 8M |
||||||
|
character-set-server = UTF8MB4 |
||||||
|
|
||||||
|
max_connections = 500 |
||||||
|
max_connect_errors = 100 |
||||||
|
open_files_limit = 2560 |
||||||
|
max_allowed_packet = 128M |
||||||
|
|
||||||
|
#skip-external-locking |
||||||
|
#skip-grant-tables |
||||||
|
#loose-skip-innodb |
||||||
|
#skip-networking |
||||||
|
#skip-name-resolve |
||||||
|
|
||||||
|
log-bin=mysql-bin |
||||||
|
slow_query_log=1 |
||||||
|
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log |
||||||
|
long_query_time=3 |
||||||
|
#log_queries_not_using_indexes=on |
||||||
|
|
||||||
|
relay-log=mdserver |
||||||
|
relay-log-index=mdserver |
||||||
|
|
||||||
|
#master |
||||||
|
#sync_binlog=1 |
||||||
|
|
||||||
|
#binlog-do-db |
||||||
|
binlog-ignore-db = test |
||||||
|
binlog-ignore-db = mysql |
||||||
|
binlog-ignore-db = information_schema |
||||||
|
binlog-ignore-db = performance_schema |
||||||
|
|
||||||
|
#slave |
||||||
|
log_replica_updates |
||||||
|
#replicate-do-db |
||||||
|
replica_skip_errors=1062,1396 |
||||||
|
replicate-ignore-db = information_schema |
||||||
|
replicate-ignore-db = performance_schema |
||||||
|
replicate-ignore-db = mysql |
||||||
|
replicate-ignore-db = test |
||||||
|
|
||||||
|
default_storage_engine = InnoDB |
||||||
|
innodb_data_home_dir = {$SERVER_APP_PATH}/data |
||||||
|
innodb_data_file_path = ibdata1:10M:autoextend |
||||||
|
innodb_log_group_home_dir = {$SERVER_APP_PATH}/data |
||||||
|
innodb_buffer_pool_size = 16M |
||||||
|
innodb_redo_log_capacity=10485760 |
||||||
|
innodb_log_buffer_size = 8M |
||||||
|
innodb_flush_log_at_trx_commit = 1 |
||||||
|
innodb_lock_wait_timeout = 120 |
||||||
|
innodb_max_dirty_pages_pct = 90 |
||||||
|
innodb_read_io_threads = 1 |
||||||
|
innodb_write_io_threads = 1 |
||||||
|
innodb_file_per_table=1 |
||||||
|
binlog_expire_logs_seconds=2592000 |
||||||
|
|
||||||
|
secure-file-priv={$SERVER_APP_PATH}/tmp |
||||||
|
|
||||||
|
[mysqldump] |
||||||
|
quick |
||||||
|
|
||||||
|
[mysql] |
||||||
|
no-auto-rehash |
||||||
|
|
||||||
|
[myisamchk] |
||||||
|
key_buffer_size = 20M |
||||||
|
sort_buffer_size = 20M |
||||||
|
read_buffer = 2M |
||||||
|
write_buffer = 2M |
||||||
|
|
||||||
|
[mysqlhotcopy] |
||||||
|
interactive-timeout |
@ -0,0 +1,103 @@ |
|||||||
|
[client] |
||||||
|
user = root |
||||||
|
#password = your_password |
||||||
|
port = 33206 |
||||||
|
socket = {$SERVER_APP_PATH}/mysql.sock |
||||||
|
default-character-set = UTF8MB4 |
||||||
|
|
||||||
|
[mysqld] |
||||||
|
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf |
||||||
|
|
||||||
|
authentication_policy=caching_sha2_password |
||||||
|
pid-file = {$SERVER_APP_PATH}/data/mysql.pid |
||||||
|
user = mysql |
||||||
|
port = 33206 |
||||||
|
mysqlx_port = 33260 |
||||||
|
socket = {$SERVER_APP_PATH}/mysql.sock |
||||||
|
datadir = {$SERVER_APP_PATH}/data |
||||||
|
log-error = {$SERVER_APP_PATH}/data/error.log |
||||||
|
server-id = {$SERVER_ID} |
||||||
|
|
||||||
|
default_storage_engine = InnoDB |
||||||
|
|
||||||
|
key_buffer_size = 8M |
||||||
|
table_open_cache = 32 |
||||||
|
sort_buffer_size = 256K |
||||||
|
net_buffer_length = 4K |
||||||
|
read_buffer_size = 128K |
||||||
|
read_rnd_buffer_size = 256K |
||||||
|
myisam_sort_buffer_size = 4M |
||||||
|
thread_cache_size = 4 |
||||||
|
lower_case_table_names=1 |
||||||
|
tmp_table_size = 8M |
||||||
|
character-set-server = UTF8MB4 |
||||||
|
|
||||||
|
max_connections = 500 |
||||||
|
max_connect_errors = 100 |
||||||
|
open_files_limit = 2560 |
||||||
|
max_allowed_packet = 128M |
||||||
|
|
||||||
|
#skip-external-locking |
||||||
|
#skip-grant-tables |
||||||
|
#loose-skip-innodb |
||||||
|
#skip-networking |
||||||
|
#skip-name-resolve |
||||||
|
|
||||||
|
log-bin=mysql-bin |
||||||
|
slow_query_log=1 |
||||||
|
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log |
||||||
|
long_query_time=3 |
||||||
|
#log_queries_not_using_indexes=on |
||||||
|
|
||||||
|
relay-log=mdserver |
||||||
|
relay-log-index=mdserver |
||||||
|
|
||||||
|
#master |
||||||
|
#sync_binlog=1 |
||||||
|
|
||||||
|
#binlog-do-db |
||||||
|
binlog-ignore-db = test |
||||||
|
binlog-ignore-db = mysql |
||||||
|
binlog-ignore-db = information_schema |
||||||
|
binlog-ignore-db = performance_schema |
||||||
|
|
||||||
|
#slave |
||||||
|
log_replica_updates |
||||||
|
#replicate-do-db |
||||||
|
replica_skip_errors=1062,1396 |
||||||
|
replicate-ignore-db = information_schema |
||||||
|
replicate-ignore-db = performance_schema |
||||||
|
replicate-ignore-db = mysql |
||||||
|
replicate-ignore-db = test |
||||||
|
|
||||||
|
default_storage_engine = InnoDB |
||||||
|
innodb_data_home_dir = {$SERVER_APP_PATH}/data |
||||||
|
innodb_data_file_path = ibdata1:10M:autoextend |
||||||
|
innodb_log_group_home_dir = {$SERVER_APP_PATH}/data |
||||||
|
innodb_buffer_pool_size = 16M |
||||||
|
innodb_redo_log_capacity=10485760 |
||||||
|
innodb_log_buffer_size = 8M |
||||||
|
innodb_flush_log_at_trx_commit = 1 |
||||||
|
innodb_lock_wait_timeout = 120 |
||||||
|
innodb_max_dirty_pages_pct = 90 |
||||||
|
innodb_read_io_threads = 1 |
||||||
|
innodb_write_io_threads = 1 |
||||||
|
innodb_file_per_table=1 |
||||||
|
binlog_expire_logs_seconds=2592000 |
||||||
|
|
||||||
|
secure-file-priv={$SERVER_APP_PATH}/tmp |
||||||
|
|
||||||
|
[mysqldump] |
||||||
|
quick |
||||||
|
|
||||||
|
[mysql] |
||||||
|
no-auto-rehash |
||||||
|
|
||||||
|
[myisamchk] |
||||||
|
key_buffer_size = 20M |
||||||
|
sort_buffer_size = 20M |
||||||
|
read_buffer = 2M |
||||||
|
write_buffer = 2M |
||||||
|
|
||||||
|
[mysqlhotcopy] |
||||||
|
interactive-timeout |
@ -0,0 +1,103 @@ |
|||||||
|
[client] |
||||||
|
user = root |
||||||
|
#password = your_password |
||||||
|
port = 33206 |
||||||
|
socket = {$SERVER_APP_PATH}/mysql.sock |
||||||
|
default-character-set = UTF8MB4 |
||||||
|
|
||||||
|
[mysqld] |
||||||
|
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf |
||||||
|
|
||||||
|
authentication_policy=caching_sha2_password |
||||||
|
pid-file = {$SERVER_APP_PATH}/data/mysql.pid |
||||||
|
user = mysql |
||||||
|
port = 33206 |
||||||
|
mysqlx_port = 33260 |
||||||
|
socket = {$SERVER_APP_PATH}/mysql.sock |
||||||
|
datadir = {$SERVER_APP_PATH}/data |
||||||
|
log-error = {$SERVER_APP_PATH}/data/error.log |
||||||
|
server-id = {$SERVER_ID} |
||||||
|
|
||||||
|
default_storage_engine = InnoDB |
||||||
|
|
||||||
|
key_buffer_size = 8M |
||||||
|
table_open_cache = 32 |
||||||
|
sort_buffer_size = 256K |
||||||
|
net_buffer_length = 4K |
||||||
|
read_buffer_size = 128K |
||||||
|
read_rnd_buffer_size = 256K |
||||||
|
myisam_sort_buffer_size = 4M |
||||||
|
thread_cache_size = 4 |
||||||
|
lower_case_table_names=1 |
||||||
|
tmp_table_size = 8M |
||||||
|
character-set-server = UTF8MB4 |
||||||
|
|
||||||
|
max_connections = 500 |
||||||
|
max_connect_errors = 100 |
||||||
|
open_files_limit = 2560 |
||||||
|
max_allowed_packet = 128M |
||||||
|
|
||||||
|
#skip-external-locking |
||||||
|
#skip-grant-tables |
||||||
|
#loose-skip-innodb |
||||||
|
#skip-networking |
||||||
|
#skip-name-resolve |
||||||
|
|
||||||
|
log-bin=mysql-bin |
||||||
|
slow_query_log=1 |
||||||
|
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log |
||||||
|
long_query_time=3 |
||||||
|
#log_queries_not_using_indexes=on |
||||||
|
|
||||||
|
relay-log=mdserver |
||||||
|
relay-log-index=mdserver |
||||||
|
|
||||||
|
#master |
||||||
|
#sync_binlog=1 |
||||||
|
|
||||||
|
#binlog-do-db |
||||||
|
binlog-ignore-db = test |
||||||
|
binlog-ignore-db = mysql |
||||||
|
binlog-ignore-db = information_schema |
||||||
|
binlog-ignore-db = performance_schema |
||||||
|
|
||||||
|
#slave |
||||||
|
log_replica_updates |
||||||
|
#replicate-do-db |
||||||
|
replica_skip_errors=1062,1396 |
||||||
|
replicate-ignore-db = information_schema |
||||||
|
replicate-ignore-db = performance_schema |
||||||
|
replicate-ignore-db = mysql |
||||||
|
replicate-ignore-db = test |
||||||
|
|
||||||
|
default_storage_engine = InnoDB |
||||||
|
innodb_data_home_dir = {$SERVER_APP_PATH}/data |
||||||
|
innodb_data_file_path = ibdata1:10M:autoextend |
||||||
|
innodb_log_group_home_dir = {$SERVER_APP_PATH}/data |
||||||
|
innodb_buffer_pool_size = 16M |
||||||
|
innodb_redo_log_capacity=10485760 |
||||||
|
innodb_log_buffer_size = 8M |
||||||
|
innodb_flush_log_at_trx_commit = 1 |
||||||
|
innodb_lock_wait_timeout = 120 |
||||||
|
innodb_max_dirty_pages_pct = 90 |
||||||
|
innodb_read_io_threads = 1 |
||||||
|
innodb_write_io_threads = 1 |
||||||
|
innodb_file_per_table=1 |
||||||
|
binlog_expire_logs_seconds=2592000 |
||||||
|
|
||||||
|
secure-file-priv={$SERVER_APP_PATH}/tmp |
||||||
|
|
||||||
|
[mysqldump] |
||||||
|
quick |
||||||
|
|
||||||
|
[mysql] |
||||||
|
no-auto-rehash |
||||||
|
|
||||||
|
[myisamchk] |
||||||
|
key_buffer_size = 20M |
||||||
|
sort_buffer_size = 20M |
||||||
|
read_buffer = 2M |
||||||
|
write_buffer = 2M |
||||||
|
|
||||||
|
[mysqlhotcopy] |
||||||
|
interactive-timeout |
@ -0,0 +1,103 @@ |
|||||||
|
[client] |
||||||
|
user = root |
||||||
|
#password = your_password |
||||||
|
port = 33206 |
||||||
|
socket = {$SERVER_APP_PATH}/mysql.sock |
||||||
|
default-character-set = UTF8MB4 |
||||||
|
|
||||||
|
[mysqld] |
||||||
|
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf |
||||||
|
|
||||||
|
authentication_policy=caching_sha2_password |
||||||
|
pid-file = {$SERVER_APP_PATH}/data/mysql.pid |
||||||
|
user = mysql |
||||||
|
port = 33206 |
||||||
|
mysqlx_port = 33260 |
||||||
|
socket = {$SERVER_APP_PATH}/mysql.sock |
||||||
|
datadir = {$SERVER_APP_PATH}/data |
||||||
|
log-error = {$SERVER_APP_PATH}/data/error.log |
||||||
|
server-id = {$SERVER_ID} |
||||||
|
|
||||||
|
default_storage_engine = InnoDB |
||||||
|
|
||||||
|
key_buffer_size = 8M |
||||||
|
table_open_cache = 32 |
||||||
|
sort_buffer_size = 256K |
||||||
|
net_buffer_length = 4K |
||||||
|
read_buffer_size = 128K |
||||||
|
read_rnd_buffer_size = 256K |
||||||
|
myisam_sort_buffer_size = 4M |
||||||
|
thread_cache_size = 4 |
||||||
|
lower_case_table_names=1 |
||||||
|
tmp_table_size = 8M |
||||||
|
character-set-server = UTF8MB4 |
||||||
|
|
||||||
|
max_connections = 500 |
||||||
|
max_connect_errors = 100 |
||||||
|
open_files_limit = 2560 |
||||||
|
max_allowed_packet = 128M |
||||||
|
|
||||||
|
#skip-external-locking |
||||||
|
#skip-grant-tables |
||||||
|
#loose-skip-innodb |
||||||
|
#skip-networking |
||||||
|
#skip-name-resolve |
||||||
|
|
||||||
|
log-bin=mysql-bin |
||||||
|
slow_query_log=1 |
||||||
|
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log |
||||||
|
long_query_time=3 |
||||||
|
#log_queries_not_using_indexes=on |
||||||
|
|
||||||
|
relay-log=mdserver |
||||||
|
relay-log-index=mdserver |
||||||
|
|
||||||
|
#master |
||||||
|
#sync_binlog=1 |
||||||
|
|
||||||
|
#binlog-do-db |
||||||
|
binlog-ignore-db = test |
||||||
|
binlog-ignore-db = mysql |
||||||
|
binlog-ignore-db = information_schema |
||||||
|
binlog-ignore-db = performance_schema |
||||||
|
|
||||||
|
#slave |
||||||
|
log_replica_updates |
||||||
|
#replicate-do-db |
||||||
|
replica_skip_errors=1062,1396 |
||||||
|
replicate-ignore-db = information_schema |
||||||
|
replicate-ignore-db = performance_schema |
||||||
|
replicate-ignore-db = mysql |
||||||
|
replicate-ignore-db = test |
||||||
|
|
||||||
|
default_storage_engine = InnoDB |
||||||
|
innodb_data_home_dir = {$SERVER_APP_PATH}/data |
||||||
|
innodb_data_file_path = ibdata1:10M:autoextend |
||||||
|
innodb_log_group_home_dir = {$SERVER_APP_PATH}/data |
||||||
|
innodb_buffer_pool_size = 16M |
||||||
|
innodb_redo_log_capacity=10485760 |
||||||
|
innodb_log_buffer_size = 8M |
||||||
|
innodb_flush_log_at_trx_commit = 1 |
||||||
|
innodb_lock_wait_timeout = 120 |
||||||
|
innodb_max_dirty_pages_pct = 90 |
||||||
|
innodb_read_io_threads = 1 |
||||||
|
innodb_write_io_threads = 1 |
||||||
|
innodb_file_per_table=1 |
||||||
|
binlog_expire_logs_seconds=2592000 |
||||||
|
|
||||||
|
secure-file-priv={$SERVER_APP_PATH}/tmp |
||||||
|
|
||||||
|
[mysqldump] |
||||||
|
quick |
||||||
|
|
||||||
|
[mysql] |
||||||
|
no-auto-rehash |
||||||
|
|
||||||
|
[myisamchk] |
||||||
|
key_buffer_size = 20M |
||||||
|
sort_buffer_size = 20M |
||||||
|
read_buffer = 2M |
||||||
|
write_buffer = 2M |
||||||
|
|
||||||
|
[mysqlhotcopy] |
||||||
|
interactive-timeout |
@ -0,0 +1,58 @@ |
|||||||
|
CREATE TABLE IF NOT EXISTS `config` ( |
||||||
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT, |
||||||
|
`mysql_root` TEXT |
||||||
|
); |
||||||
|
|
||||||
|
INSERT INTO `config` (`id`, `mysql_root`) VALUES (1, 'admin'); |
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `databases` ( |
||||||
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT, |
||||||
|
`pid` INTEGER, |
||||||
|
`name` TEXT, |
||||||
|
`username` TEXT, |
||||||
|
`password` TEXT, |
||||||
|
`accept` TEXT, |
||||||
|
`rw` TEXT DEFAULT 'rw', |
||||||
|
`ps` TEXT, |
||||||
|
`addtime` TEXT |
||||||
|
); |
||||||
|
-- ALTER TABLE `databases` ADD COLUMN `rw` TEXT DEFAULT 'rw'; |
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `master_replication_user` ( |
||||||
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT, |
||||||
|
`username` TEXT, |
||||||
|
`password` TEXT, |
||||||
|
`accept` TEXT, |
||||||
|
`ps` TEXT, |
||||||
|
`addtime` TEXT |
||||||
|
); |
||||||
|
|
||||||
|
-- 从库配置主库的[ssh private key] |
||||||
|
-- drop table `slave_id_rsa`; |
||||||
|
CREATE TABLE IF NOT EXISTS `slave_id_rsa` ( |
||||||
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT, |
||||||
|
`ip` TEXT, |
||||||
|
`port` TEXT, |
||||||
|
`user` TEXT, |
||||||
|
`db_user` TEXT, |
||||||
|
`id_rsa` TEXT, |
||||||
|
`ps` TEXT, |
||||||
|
`addtime` TEXT |
||||||
|
); |
||||||
|
|
||||||
|
-- 从库配置主库的[user] |
||||||
|
-- drop table `slave_user`; |
||||||
|
CREATE TABLE IF NOT EXISTS `slave_sync_user` ( |
||||||
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT, |
||||||
|
`ip` TEXT, |
||||||
|
`port` TEXT, |
||||||
|
`user` TEXT, |
||||||
|
`pass` TEXT, |
||||||
|
`mode` TEXT, |
||||||
|
`cmd` TEXT, |
||||||
|
`db` TEXT, |
||||||
|
`addtime` TEXT |
||||||
|
); |
||||||
|
ALTER TABLE `slave_sync_user` ADD COLUMN `db` TEXT DEFAULT ''; |
||||||
|
|
||||||
|
|
After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1,59 @@ |
|||||||
|
<div class="bt-form"> |
||||||
|
<div class='plugin_version'></div> |
||||||
|
<div class="bt-w-main"> |
||||||
|
<div class="bt-w-menu"> |
||||||
|
<!-- <script type="text/javascript">console.log($('.plugin_version').attr('version'));</script> --> |
||||||
|
<p class="bgw" onclick="pluginService('mysql-community', $('.plugin_version').attr('version'));">服务</p> |
||||||
|
<p onclick="pluginInitD('mysql-community', $('.plugin_version').attr('version'));">自启动</p> |
||||||
|
<p onclick="pluginConfig('mysql-community', $('.plugin_version').attr('version'));">配置文件</p> |
||||||
|
<p onclick="myDbPos();">存储位置</p> |
||||||
|
<p onclick="myPort();">端口</p> |
||||||
|
<p onclick="runInfo();">当前状态</p> |
||||||
|
<p onclick="myPerfOpt();">性能优化</p> |
||||||
|
<p onclick="myLogs();">日志</p> |
||||||
|
<p onclick="pluginLogs('mysql-community',$('.plugin_version').attr('version'),'show_log');">慢日志</p> |
||||||
|
<p onclick="myBinLogs();">BINLOG</p> |
||||||
|
<p onclick="dbList()">管理列表</p> |
||||||
|
<p onclick="masterOrSlaveConf($('.plugin_version').attr('version'))">主从配置</p> |
||||||
|
</div> |
||||||
|
<div class="bt-w-con pd15" style="height:555px;overflow: auto;"> |
||||||
|
<div class="soft-man-con"></div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
</div> |
||||||
|
|
||||||
|
|
||||||
|
<style type="text/css"> |
||||||
|
.db_list{ |
||||||
|
padding: 0px 0 10px 0; |
||||||
|
font-size: 13px; |
||||||
|
line-height: 35px; |
||||||
|
height: 45px; |
||||||
|
} |
||||||
|
.db_list a{ |
||||||
|
margin-right: 15px; |
||||||
|
color: #555; |
||||||
|
font-weight: 600; |
||||||
|
} |
||||||
|
.db_list span:nth-child(1){ |
||||||
|
display: block; |
||||||
|
float: left; |
||||||
|
padding-left: 15px; |
||||||
|
background: #ececec; |
||||||
|
border-radius: 3px; |
||||||
|
} |
||||||
|
|
||||||
|
#db_tools button { |
||||||
|
margin-right: 10px; |
||||||
|
} |
||||||
|
#db_tools button:last-child{ |
||||||
|
margin-right: 0; |
||||||
|
} |
||||||
|
</style> |
||||||
|
<script type="text/javascript"> |
||||||
|
resetPluginWinWidth(800); |
||||||
|
$.getScript( "/plugins/file?name=mysql-community&f=js/mysql-community.js", function(){ |
||||||
|
pluginService('mysql-community',$('.plugin_version').attr('version')); |
||||||
|
}); |
||||||
|
</script> |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,189 @@ |
|||||||
|
# coding:utf-8 |
||||||
|
|
||||||
|
import sys |
||||||
|
import io |
||||||
|
import os |
||||||
|
import time |
||||||
|
import subprocess |
||||||
|
import re |
||||||
|
import json |
||||||
|
|
||||||
|
web_dir = os.getcwd() + "/web" |
||||||
|
if os.path.exists(web_dir): |
||||||
|
sys.path.append(web_dir) |
||||||
|
os.chdir(web_dir) |
||||||
|
|
||||||
|
import core.mw as mw |
||||||
|
|
||||||
|
# if mw.isAppleSystem(): |
||||||
|
# cmd = 'ls /usr/local/lib/ | grep python | cut -d \\ -f 1 | awk \'END {print}\'' |
||||||
|
# info = mw.execShell(cmd) |
||||||
|
# p = "/usr/local/lib/" + info[0].strip() + "/site-packages" |
||||||
|
# sys.path.append(p) |
||||||
|
|
||||||
|
|
||||||
|
app_debug = False |
||||||
|
if mw.isAppleSystem(): |
||||||
|
app_debug = True |
||||||
|
|
||||||
|
|
||||||
|
def getPluginName(): |
||||||
|
return 'mysql-community' |
||||||
|
|
||||||
|
|
||||||
|
def getPluginDir(): |
||||||
|
return mw.getPluginDir() + '/' + getPluginName() |
||||||
|
|
||||||
|
|
||||||
|
def getSPluginDir(): |
||||||
|
return '/www/server/mdserver-web/plugins/' + getPluginName() |
||||||
|
|
||||||
|
|
||||||
|
def getServerDir(): |
||||||
|
return mw.getServerDir() + '/' + getPluginName() |
||||||
|
|
||||||
|
|
||||||
|
def getConf(): |
||||||
|
path = getServerDir() + '/etc/my.cnf' |
||||||
|
return path |
||||||
|
|
||||||
|
|
||||||
|
def getDataDir(): |
||||||
|
file = getConf() |
||||||
|
content = mw.readFile(file) |
||||||
|
rep = r'datadir\s*=\s*(.*)' |
||||||
|
tmp = re.search(rep, content) |
||||||
|
return tmp.groups()[0].strip() |
||||||
|
|
||||||
|
|
||||||
|
def getRelayLogName(): |
||||||
|
file = getConf() |
||||||
|
content = mw.readFile(file) |
||||||
|
rep = r'relay-log\s*=\s*(.*)' |
||||||
|
tmp = re.search(rep, content) |
||||||
|
return tmp.groups()[0].strip() |
||||||
|
|
||||||
|
|
||||||
|
def getLogBinName(): |
||||||
|
file = getConf() |
||||||
|
content = mw.readFile(file) |
||||||
|
rep = r'log-bin\s*=\s*(.*)' |
||||||
|
tmp = re.search(rep, content) |
||||||
|
return tmp.groups()[0].strip() |
||||||
|
|
||||||
|
|
||||||
|
def binLogListLook(args): |
||||||
|
|
||||||
|
file = args['file'] |
||||||
|
line = args['line'] |
||||||
|
|
||||||
|
data_dir = getDataDir() |
||||||
|
my_bin = getServerDir() + '/bin' |
||||||
|
my_binlog_cmd = my_bin + '/mysqlbinlog' |
||||||
|
|
||||||
|
cmd = my_binlog_cmd + ' --no-defaults ' + \ |
||||||
|
data_dir + '/' + file + '|tail -' + str(line) |
||||||
|
|
||||||
|
data = mw.execShell(cmd) |
||||||
|
|
||||||
|
rdata = {} |
||||||
|
rdata['cmd'] = cmd |
||||||
|
rdata['data'] = data[0] |
||||||
|
|
||||||
|
return rdata |
||||||
|
|
||||||
|
|
||||||
|
def binLogListLookDecode(args): |
||||||
|
|
||||||
|
file = args['file'] |
||||||
|
line = args['line'] |
||||||
|
|
||||||
|
data_dir = getDataDir() |
||||||
|
my_bin = getServerDir() + '/bin' |
||||||
|
my_binlog_cmd = my_bin + '/mysqlbinlog' |
||||||
|
|
||||||
|
cmd = my_binlog_cmd + ' --no-defaults --base64-output=decode-rows -vvvv ' + \ |
||||||
|
data_dir + '/' + file + '|tail -' + str(line) |
||||||
|
|
||||||
|
data = mw.execShell(cmd) |
||||||
|
|
||||||
|
rdata = {} |
||||||
|
rdata['cmd'] = cmd |
||||||
|
rdata['data'] = data[0] |
||||||
|
|
||||||
|
return rdata |
||||||
|
|
||||||
|
|
||||||
|
def binLogListTraceRelay(args): |
||||||
|
rdata = {} |
||||||
|
file = args['file'] |
||||||
|
line = args['line'] |
||||||
|
|
||||||
|
relay_name = getRelayLogName() |
||||||
|
data_dir = getDataDir() |
||||||
|
alist = os.listdir(data_dir) |
||||||
|
relay_list = [] |
||||||
|
for x in range(len(alist)): |
||||||
|
f = alist[x] |
||||||
|
t = {} |
||||||
|
if f.startswith(relay_name) and not f.endswith('.index'): |
||||||
|
relay_list.append(f) |
||||||
|
|
||||||
|
relay_list = sorted(relay_list, reverse=True) |
||||||
|
if len(relay_list) == 0: |
||||||
|
rdata['cmd'] = '' |
||||||
|
rdata['data'] = '无Relay日志' |
||||||
|
return rdata |
||||||
|
|
||||||
|
file = relay_list[0] |
||||||
|
|
||||||
|
my_bin = getServerDir() + '/bin' |
||||||
|
my_binlog_cmd = my_bin + '/mysqlbinlog' |
||||||
|
|
||||||
|
cmd = my_binlog_cmd + ' --no-defaults --base64-output=decode-rows -vvvv ' + \ |
||||||
|
data_dir + '/' + file + '|tail -' + str(line) |
||||||
|
|
||||||
|
data = mw.execShell(cmd) |
||||||
|
|
||||||
|
rdata['cmd'] = cmd |
||||||
|
rdata['data'] = data[0] |
||||||
|
|
||||||
|
return rdata |
||||||
|
|
||||||
|
|
||||||
|
def binLogListTraceBinLog(args): |
||||||
|
rdata = {} |
||||||
|
file = args['file'] |
||||||
|
line = args['line'] |
||||||
|
|
||||||
|
data_dir = getDataDir() |
||||||
|
log_bin_name = getLogBinName() |
||||||
|
|
||||||
|
alist = os.listdir(data_dir) |
||||||
|
log_bin_l = [] |
||||||
|
for x in range(len(alist)): |
||||||
|
f = alist[x] |
||||||
|
t = {} |
||||||
|
if f.startswith(log_bin_name) and not f.endswith('.index'): |
||||||
|
log_bin_l.append(f) |
||||||
|
|
||||||
|
if len(log_bin_l) == 0: |
||||||
|
rdata['cmd'] = '' |
||||||
|
rdata['data'] = '无BINLOG' |
||||||
|
return rdata |
||||||
|
|
||||||
|
log_bin_l = sorted(log_bin_l, reverse=True) |
||||||
|
file = log_bin_l[0] |
||||||
|
|
||||||
|
my_bin = getServerDir() + '/bin' |
||||||
|
my_binlog_cmd = my_bin + '/mysqlbinlog' |
||||||
|
|
||||||
|
cmd = my_binlog_cmd + ' --no-defaults --base64-output=decode-rows -vvvv ' + \ |
||||||
|
data_dir + '/' + file + '|tail -' + str(line) |
||||||
|
|
||||||
|
data = mw.execShell(cmd) |
||||||
|
|
||||||
|
rdata['cmd'] = cmd |
||||||
|
rdata['data'] = data[0] |
||||||
|
|
||||||
|
return rdata |
@ -0,0 +1,19 @@ |
|||||||
|
{ |
||||||
|
"hook":["database"], |
||||||
|
"title":"MySQL[Tar]", |
||||||
|
"tip":"soft", |
||||||
|
"name":"mysql-community", |
||||||
|
"type":"运行环境", |
||||||
|
"ps":"一种关系数据库管理系统(极速安装)", |
||||||
|
"todo_versions":["5.7","8.0"], |
||||||
|
"versions":["5.7","8.0","8.2","8.3","8.4","9.0","9.1"], |
||||||
|
"shell":"install.sh", |
||||||
|
"install_pre_inspection":true, |
||||||
|
"uninstall_pre_inspection":true, |
||||||
|
"checks":"server/mysql-community", |
||||||
|
"path":"server/mysql-community", |
||||||
|
"author":"mysql", |
||||||
|
"home":"https://dev.mysql.com/downloads/mysql", |
||||||
|
"date":"2022-06-29", |
||||||
|
"pid": "6" |
||||||
|
} |
@ -0,0 +1,43 @@ |
|||||||
|
# Copyright (c) 2015, 2022, Oracle and/or its affiliates. |
||||||
|
# |
||||||
|
# This program is free software; you can redistribute it and/or modify |
||||||
|
# it under the terms of the GNU General Public License, version 2.0, |
||||||
|
# as published by the Free Software Foundation. |
||||||
|
# |
||||||
|
# This program is also distributed with certain software (including |
||||||
|
# but not limited to OpenSSL) that is licensed under separate terms, |
||||||
|
# as designated in a particular file or component or in included license |
||||||
|
# documentation. The authors of MySQL hereby grant you an additional |
||||||
|
# permission to link the program and your derivative works with the |
||||||
|
# separately licensed software that they have included with MySQL. |
||||||
|
# |
||||||
|
# This program is distributed in the hope that it will be useful, |
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
# GNU General Public License, version 2.0, for more details. |
||||||
|
# |
||||||
|
# You should have received a copy of the GNU General Public License |
||||||
|
# along with this program; if not, write to the Free Software |
||||||
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
||||||
|
|
||||||
|
# MySQL systemd service file |
||||||
|
|
||||||
|
[Unit] |
||||||
|
Description=MySQL Community Server |
||||||
|
After=network.target |
||||||
|
|
||||||
|
[Service] |
||||||
|
User=mysql |
||||||
|
Group=mysql |
||||||
|
Type=simple |
||||||
|
PermissionsStartOnly=true |
||||||
|
ExecStart={$SERVER_PATH}/mysql-community/bin/mysqld --defaults-file={$SERVER_PATH}/mysql-community/etc/my.cnf |
||||||
|
TimeoutSec=600 |
||||||
|
LimitNOFILE = 5000 |
||||||
|
Restart=on-failure |
||||||
|
RestartPreventExitStatus=1 |
||||||
|
RuntimeDirectory=mysqld |
||||||
|
RuntimeDirectoryMode=755 |
||||||
|
|
||||||
|
[Install] |
||||||
|
WantedBy=multi-user.target |
@ -0,0 +1,50 @@ |
|||||||
|
# Copyright (c) 2015, 2022, Oracle and/or its affiliates. |
||||||
|
# |
||||||
|
# This program is free software; you can redistribute it and/or modify |
||||||
|
# it under the terms of the GNU General Public License, version 2.0, |
||||||
|
# as published by the Free Software Foundation. |
||||||
|
# |
||||||
|
# This program is also distributed with certain software (including |
||||||
|
# but not limited to OpenSSL) that is licensed under separate terms, |
||||||
|
# as designated in a particular file or component or in included license |
||||||
|
# documentation. The authors of MySQL hereby grant you an additional |
||||||
|
# permission to link the program and your derivative works with the |
||||||
|
# separately licensed software that they have included with MySQL. |
||||||
|
# |
||||||
|
# This program is distributed in the hope that it will be useful, |
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
# GNU General Public License, version 2.0, for more details. |
||||||
|
# |
||||||
|
# You should have received a copy of the GNU General Public License |
||||||
|
# along with this program; if not, write to the Free Software |
||||||
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
||||||
|
|
||||||
|
# MySQL systemd service file |
||||||
|
|
||||||
|
[Unit] |
||||||
|
Description=MySQL Community Server |
||||||
|
Documentation=man:mysqld(8) |
||||||
|
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html |
||||||
|
After=network.target |
||||||
|
|
||||||
|
[Install] |
||||||
|
WantedBy=multi-user.target |
||||||
|
|
||||||
|
[Service] |
||||||
|
User=mysql |
||||||
|
Group=mysql |
||||||
|
Type=notify |
||||||
|
#ExecStartPre=+/usr/share/mysql-8.0/mysql-systemd-start pre |
||||||
|
ExecStart={$SERVER_PATH}/mysql-community/bin/mysqld --defaults-file={$SERVER_PATH}/mysql-community/etc/my.cnf |
||||||
|
TimeoutSec=600 |
||||||
|
LimitNOFILE = 10000 |
||||||
|
Restart=on-failure |
||||||
|
RestartPreventExitStatus=1 |
||||||
|
|
||||||
|
# Always restart when mysqld exits with exit code of 16. This special exit code |
||||||
|
# is used by mysqld for RESTART SQL. |
||||||
|
RestartForceExitStatus=16 |
||||||
|
|
||||||
|
# Set enviroment variable MYSQLD_PARENT_PID. This is required for restart. |
||||||
|
Environment=MYSQLD_PARENT_PID=1 |
@ -0,0 +1,50 @@ |
|||||||
|
# Copyright (c) 2015, 2022, Oracle and/or its affiliates. |
||||||
|
# |
||||||
|
# This program is free software; you can redistribute it and/or modify |
||||||
|
# it under the terms of the GNU General Public License, version 2.0, |
||||||
|
# as published by the Free Software Foundation. |
||||||
|
# |
||||||
|
# This program is also distributed with certain software (including |
||||||
|
# but not limited to OpenSSL) that is licensed under separate terms, |
||||||
|
# as designated in a particular file or component or in included license |
||||||
|
# documentation. The authors of MySQL hereby grant you an additional |
||||||
|
# permission to link the program and your derivative works with the |
||||||
|
# separately licensed software that they have included with MySQL. |
||||||
|
# |
||||||
|
# This program is distributed in the hope that it will be useful, |
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
# GNU General Public License, version 2.0, for more details. |
||||||
|
# |
||||||
|
# You should have received a copy of the GNU General Public License |
||||||
|
# along with this program; if not, write to the Free Software |
||||||
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
||||||
|
|
||||||
|
# MySQL systemd service file |
||||||
|
|
||||||
|
[Unit] |
||||||
|
Description=MySQL Community Server |
||||||
|
Documentation=man:mysqld(8) |
||||||
|
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html |
||||||
|
After=network.target |
||||||
|
|
||||||
|
[Install] |
||||||
|
WantedBy=multi-user.target |
||||||
|
|
||||||
|
[Service] |
||||||
|
User=mysql |
||||||
|
Group=mysql |
||||||
|
Type=notify |
||||||
|
#ExecStartPre=+/usr/share/mysql-8.0/mysql-systemd-start pre |
||||||
|
ExecStart={$SERVER_PATH}/mysql-community/bin/mysqld --defaults-file={$SERVER_PATH}/mysql-community/etc/my.cnf |
||||||
|
TimeoutSec=600 |
||||||
|
LimitNOFILE = 10000 |
||||||
|
Restart=on-failure |
||||||
|
RestartPreventExitStatus=1 |
||||||
|
|
||||||
|
# Always restart when mysqld exits with exit code of 16. This special exit code |
||||||
|
# is used by mysqld for RESTART SQL. |
||||||
|
RestartForceExitStatus=16 |
||||||
|
|
||||||
|
# Set enviroment variable MYSQLD_PARENT_PID. This is required for restart. |
||||||
|
Environment=MYSQLD_PARENT_PID=1 |
@ -0,0 +1,50 @@ |
|||||||
|
# Copyright (c) 2015, 2022, Oracle and/or its affiliates. |
||||||
|
# |
||||||
|
# This program is free software; you can redistribute it and/or modify |
||||||
|
# it under the terms of the GNU General Public License, version 2.0, |
||||||
|
# as published by the Free Software Foundation. |
||||||
|
# |
||||||
|
# This program is also distributed with certain software (including |
||||||
|
# but not limited to OpenSSL) that is licensed under separate terms, |
||||||
|
# as designated in a particular file or component or in included license |
||||||
|
# documentation. The authors of MySQL hereby grant you an additional |
||||||
|
# permission to link the program and your derivative works with the |
||||||
|
# separately licensed software that they have included with MySQL. |
||||||
|
# |
||||||
|
# This program is distributed in the hope that it will be useful, |
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
# GNU General Public License, version 2.0, for more details. |
||||||
|
# |
||||||
|
# You should have received a copy of the GNU General Public License |
||||||
|
# along with this program; if not, write to the Free Software |
||||||
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
||||||
|
|
||||||
|
# MySQL systemd service file |
||||||
|
|
||||||
|
[Unit] |
||||||
|
Description=MySQL Community Server |
||||||
|
Documentation=man:mysqld(8) |
||||||
|
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html |
||||||
|
After=network.target |
||||||
|
|
||||||
|
[Install] |
||||||
|
WantedBy=multi-user.target |
||||||
|
|
||||||
|
[Service] |
||||||
|
User=mysql |
||||||
|
Group=mysql |
||||||
|
Type=notify |
||||||
|
#ExecStartPre=+/usr/share/mysql-8.0/mysql-systemd-start pre |
||||||
|
ExecStart={$SERVER_PATH}/mysql-community/bin/mysqld --defaults-file={$SERVER_PATH}/mysql-community/etc/my.cnf |
||||||
|
TimeoutSec=600 |
||||||
|
LimitNOFILE = 10000 |
||||||
|
Restart=on-failure |
||||||
|
RestartPreventExitStatus=1 |
||||||
|
|
||||||
|
# Always restart when mysqld exits with exit code of 16. This special exit code |
||||||
|
# is used by mysqld for RESTART SQL. |
||||||
|
RestartForceExitStatus=16 |
||||||
|
|
||||||
|
# Set enviroment variable MYSQLD_PARENT_PID. This is required for restart. |
||||||
|
Environment=MYSQLD_PARENT_PID=1 |
@ -0,0 +1,50 @@ |
|||||||
|
# Copyright (c) 2015, 2022, Oracle and/or its affiliates. |
||||||
|
# |
||||||
|
# This program is free software; you can redistribute it and/or modify |
||||||
|
# it under the terms of the GNU General Public License, version 2.0, |
||||||
|
# as published by the Free Software Foundation. |
||||||
|
# |
||||||
|
# This program is also distributed with certain software (including |
||||||
|
# but not limited to OpenSSL) that is licensed under separate terms, |
||||||
|
# as designated in a particular file or component or in included license |
||||||
|
# documentation. The authors of MySQL hereby grant you an additional |
||||||
|
# permission to link the program and your derivative works with the |
||||||
|
# separately licensed software that they have included with MySQL. |
||||||
|
# |
||||||
|
# This program is distributed in the hope that it will be useful, |
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
# GNU General Public License, version 2.0, for more details. |
||||||
|
# |
||||||
|
# You should have received a copy of the GNU General Public License |
||||||
|
# along with this program; if not, write to the Free Software |
||||||
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
||||||
|
|
||||||
|
# MySQL systemd service file |
||||||
|
|
||||||
|
[Unit] |
||||||
|
Description=MySQL Community Server |
||||||
|
Documentation=man:mysqld(8) |
||||||
|
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html |
||||||
|
After=network.target |
||||||
|
|
||||||
|
[Install] |
||||||
|
WantedBy=multi-user.target |
||||||
|
|
||||||
|
[Service] |
||||||
|
User=mysql |
||||||
|
Group=mysql |
||||||
|
Type=notify |
||||||
|
#ExecStartPre=+/usr/share/mysql-8.0/mysql-systemd-start pre |
||||||
|
ExecStart={$SERVER_PATH}/mysql-community/bin/mysqld --defaults-file={$SERVER_PATH}/mysql-community/etc/my.cnf |
||||||
|
TimeoutSec=600 |
||||||
|
LimitNOFILE = 10000 |
||||||
|
Restart=on-failure |
||||||
|
RestartPreventExitStatus=1 |
||||||
|
|
||||||
|
# Always restart when mysqld exits with exit code of 16. This special exit code |
||||||
|
# is used by mysqld for RESTART SQL. |
||||||
|
RestartForceExitStatus=16 |
||||||
|
|
||||||
|
# Set enviroment variable MYSQLD_PARENT_PID. This is required for restart. |
||||||
|
Environment=MYSQLD_PARENT_PID=1 |
@ -0,0 +1,49 @@ |
|||||||
|
# Copyright (c) 2015, 2022, Oracle and/or its affiliates. |
||||||
|
# |
||||||
|
# This program is free software; you can redistribute it and/or modify |
||||||
|
# it under the terms of the GNU General Public License, version 2.0, |
||||||
|
# as published by the Free Software Foundation. |
||||||
|
# |
||||||
|
# This program is also distributed with certain software (including |
||||||
|
# but not limited to OpenSSL) that is licensed under separate terms, |
||||||
|
# as designated in a particular file or component or in included license |
||||||
|
# documentation. The authors of MySQL hereby grant you an additional |
||||||
|
# permission to link the program and your derivative works with the |
||||||
|
# separately licensed software that they have included with MySQL. |
||||||
|
# |
||||||
|
# This program is distributed in the hope that it will be useful, |
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
# GNU General Public License, version 2.0, for more details. |
||||||
|
# |
||||||
|
# You should have received a copy of the GNU General Public License |
||||||
|
# along with this program; if not, write to the Free Software |
||||||
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
||||||
|
|
||||||
|
# MySQL systemd service file |
||||||
|
|
||||||
|
[Unit] |
||||||
|
Description=MySQL Community Server |
||||||
|
Documentation=man:mysqld(8) |
||||||
|
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html |
||||||
|
After=network.target |
||||||
|
|
||||||
|
[Install] |
||||||
|
WantedBy=multi-user.target |
||||||
|
|
||||||
|
[Service] |
||||||
|
User=mysql |
||||||
|
Group=mysql |
||||||
|
Type=notify |
||||||
|
ExecStart={$SERVER_PATH}/mysql-community/bin/mysqld --defaults-file={$SERVER_PATH}/mysql-community/etc/my.cnf |
||||||
|
TimeoutSec=600 |
||||||
|
LimitNOFILE = 10000 |
||||||
|
Restart=on-failure |
||||||
|
RestartPreventExitStatus=1 |
||||||
|
|
||||||
|
# Always restart when mysqld exits with exit code of 16. This special exit code |
||||||
|
# is used by mysqld for RESTART SQL. |
||||||
|
RestartForceExitStatus=16 |
||||||
|
|
||||||
|
# Set enviroment variable MYSQLD_PARENT_PID. This is required for restart. |
||||||
|
Environment=MYSQLD_PARENT_PID=1 |
@ -0,0 +1,49 @@ |
|||||||
|
# Copyright (c) 2015, 2022, Oracle and/or its affiliates. |
||||||
|
# |
||||||
|
# This program is free software; you can redistribute it and/or modify |
||||||
|
# it under the terms of the GNU General Public License, version 2.0, |
||||||
|
# as published by the Free Software Foundation. |
||||||
|
# |
||||||
|
# This program is also distributed with certain software (including |
||||||
|
# but not limited to OpenSSL) that is licensed under separate terms, |
||||||
|
# as designated in a particular file or component or in included license |
||||||
|
# documentation. The authors of MySQL hereby grant you an additional |
||||||
|
# permission to link the program and your derivative works with the |
||||||
|
# separately licensed software that they have included with MySQL. |
||||||
|
# |
||||||
|
# This program is distributed in the hope that it will be useful, |
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
# GNU General Public License, version 2.0, for more details. |
||||||
|
# |
||||||
|
# You should have received a copy of the GNU General Public License |
||||||
|
# along with this program; if not, write to the Free Software |
||||||
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
||||||
|
|
||||||
|
# MySQL systemd service file |
||||||
|
|
||||||
|
[Unit] |
||||||
|
Description=MySQL Community Server |
||||||
|
Documentation=man:mysqld(8) |
||||||
|
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html |
||||||
|
After=network.target |
||||||
|
|
||||||
|
[Install] |
||||||
|
WantedBy=multi-user.target |
||||||
|
|
||||||
|
[Service] |
||||||
|
User=mysql |
||||||
|
Group=mysql |
||||||
|
Type=notify |
||||||
|
ExecStart={$SERVER_PATH}/mysql-community/bin/mysqld --defaults-file={$SERVER_PATH}/mysql-community/etc/my.cnf |
||||||
|
TimeoutSec=600 |
||||||
|
LimitNOFILE = 10000 |
||||||
|
Restart=on-failure |
||||||
|
RestartPreventExitStatus=1 |
||||||
|
|
||||||
|
# Always restart when mysqld exits with exit code of 16. This special exit code |
||||||
|
# is used by mysqld for RESTART SQL. |
||||||
|
RestartForceExitStatus=16 |
||||||
|
|
||||||
|
# Set enviroment variable MYSQLD_PARENT_PID. This is required for restart. |
||||||
|
Environment=MYSQLD_PARENT_PID=1 |
@ -0,0 +1,49 @@ |
|||||||
|
# Copyright (c) 2015, 2022, Oracle and/or its affiliates. |
||||||
|
# |
||||||
|
# This program is free software; you can redistribute it and/or modify |
||||||
|
# it under the terms of the GNU General Public License, version 2.0, |
||||||
|
# as published by the Free Software Foundation. |
||||||
|
# |
||||||
|
# This program is also distributed with certain software (including |
||||||
|
# but not limited to OpenSSL) that is licensed under separate terms, |
||||||
|
# as designated in a particular file or component or in included license |
||||||
|
# documentation. The authors of MySQL hereby grant you an additional |
||||||
|
# permission to link the program and your derivative works with the |
||||||
|
# separately licensed software that they have included with MySQL. |
||||||
|
# |
||||||
|
# This program is distributed in the hope that it will be useful, |
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
# GNU General Public License, version 2.0, for more details. |
||||||
|
# |
||||||
|
# You should have received a copy of the GNU General Public License |
||||||
|
# along with this program; if not, write to the Free Software |
||||||
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
||||||
|
|
||||||
|
# MySQL systemd service file |
||||||
|
|
||||||
|
[Unit] |
||||||
|
Description=MySQL Community Server |
||||||
|
Documentation=man:mysqld(8) |
||||||
|
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html |
||||||
|
After=network.target |
||||||
|
|
||||||
|
[Install] |
||||||
|
WantedBy=multi-user.target |
||||||
|
|
||||||
|
[Service] |
||||||
|
User=mysql |
||||||
|
Group=mysql |
||||||
|
Type=notify |
||||||
|
ExecStart={$SERVER_PATH}/mysql-community/bin/mysqld --defaults-file={$SERVER_PATH}/mysql-community/etc/my.cnf |
||||||
|
TimeoutSec=600 |
||||||
|
LimitNOFILE = 10000 |
||||||
|
Restart=on-failure |
||||||
|
RestartPreventExitStatus=1 |
||||||
|
|
||||||
|
# Always restart when mysqld exits with exit code of 16. This special exit code |
||||||
|
# is used by mysqld for RESTART SQL. |
||||||
|
RestartForceExitStatus=16 |
||||||
|
|
||||||
|
# Set enviroment variable MYSQLD_PARENT_PID. This is required for restart. |
||||||
|
Environment=MYSQLD_PARENT_PID=1 |
@ -0,0 +1,71 @@ |
|||||||
|
#!/bin/bash |
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
||||||
|
export PATH |
||||||
|
|
||||||
|
curPath=`pwd` |
||||||
|
rootPath=$(dirname "$curPath") |
||||||
|
rootPath=$(dirname "$rootPath") |
||||||
|
serverPath=$(dirname "$rootPath") |
||||||
|
|
||||||
|
# https://dev.mysql.com/downloads/mysql/ |
||||||
|
# https://downloads.mysql.com/archives/community/ |
||||||
|
|
||||||
|
|
||||||
|
# /www/server/mysql-community/bin/mysqld --basedir=/www/server/mysql-community --datadir=/www/server/mysql-community/data --initialize-insecure --explicit_defaults_for_timestamp |
||||||
|
|
||||||
|
|
||||||
|
# cd /www/server/mdserver-web/plugins/mysql-community && bash install.sh install 8.0 |
||||||
|
# cd /www/server/mdserver-web/plugins/mysql-community && bash install.sh uninstall 8.0 |
||||||
|
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-community/index.py start 5.7 |
||||||
|
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-community/index.py fix_db_access |
||||||
|
# cd /www/server/mdserver-web && source bin/activate && python3 plugins/mysql/index.py do_full_sync {"db":"xxx","sign":"","begin":1} |
||||||
|
|
||||||
|
action=$1 |
||||||
|
type=$2 |
||||||
|
|
||||||
|
if id mysql &> /dev/null ;then |
||||||
|
echo "mysql UID is `id -u mysql`" |
||||||
|
echo "mysql Shell is `grep "^mysql:" /etc/passwd |cut -d':' -f7 `" |
||||||
|
else |
||||||
|
groupadd mysql |
||||||
|
useradd -g mysql -s /usr/sbin/nologin mysql |
||||||
|
fi |
||||||
|
|
||||||
|
|
||||||
|
if [ "${2}" == "" ];then |
||||||
|
echo '缺少安装脚本...' |
||||||
|
exit 0 |
||||||
|
fi |
||||||
|
|
||||||
|
if [ ! -d $curPath/versions/$2 ];then |
||||||
|
echo '缺少安装脚本2...' |
||||||
|
exit 0 |
||||||
|
fi |
||||||
|
|
||||||
|
if [ "${action}" == "uninstall" ];then |
||||||
|
|
||||||
|
cd ${rootPath} && python3 ${rootPath}/plugins/mysql-community/index.py stop ${type} |
||||||
|
cd ${rootPath} && python3 ${rootPath}/plugins/mysql-community/index.py initd_uninstall ${type} |
||||||
|
cd $curPath |
||||||
|
|
||||||
|
if [ -f /usr/lib/systemd/system/mysql-community.service ] || [ -f /lib/systemd/system/mysql-community.service ];then |
||||||
|
systemctl stop mysql-community |
||||||
|
systemctl disable mysql-community |
||||||
|
rm -rf /usr/lib/systemd/system/mysql-community.service |
||||||
|
rm -rf /lib/systemd/system/mysql-community.service |
||||||
|
systemctl daemon-reload |
||||||
|
fi |
||||||
|
fi |
||||||
|
|
||||||
|
|
||||||
|
sh -x $curPath/versions/$2/install_generic.sh $1 |
||||||
|
|
||||||
|
if [ "${action}" == "install" ];then |
||||||
|
#初始化 |
||||||
|
|
||||||
|
if [ "$?" != "0" ];then |
||||||
|
exit $? |
||||||
|
fi |
||||||
|
cd ${rootPath} && python3 ${rootPath}/plugins/mysql-community/index.py start ${type} |
||||||
|
cd ${rootPath} && python3 ${rootPath}/plugins/mysql-community/index.py initd_install ${type} |
||||||
|
fi |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,116 @@ |
|||||||
|
# coding: utf-8 |
||||||
|
#----------------------------- |
||||||
|
# 网站备份工具 |
||||||
|
#----------------------------- |
||||||
|
|
||||||
|
import sys |
||||||
|
import os |
||||||
|
import time |
||||||
|
import re |
||||||
|
|
||||||
|
if sys.platform != 'darwin': |
||||||
|
os.chdir('/www/server/mdserver-web') |
||||||
|
|
||||||
|
web_dir = os.getcwd() + "/web" |
||||||
|
if os.path.exists(web_dir): |
||||||
|
sys.path.append(web_dir) |
||||||
|
os.chdir(web_dir) |
||||||
|
|
||||||
|
import core.mw as mw |
||||||
|
import core.db as db |
||||||
|
|
||||||
|
''' |
||||||
|
DEBUG: |
||||||
|
python3 /www/server/mdserver-web/plugins/mysql-community/scripts/backup.py database admin 3 |
||||||
|
''' |
||||||
|
class backupTools: |
||||||
|
|
||||||
|
def backupDatabase(self, name, count): |
||||||
|
db_path = mw.getServerDir() + '/mysql-community' |
||||||
|
db_name = 'mysql' |
||||||
|
find_name = mw.M('databases').dbPos(db_path, 'mysql').where( |
||||||
|
'name=?', (name,)).getField('name') |
||||||
|
startTime = time.time() |
||||||
|
if not find_name: |
||||||
|
endDate = time.strftime('%Y/%m/%d %X', time.localtime()) |
||||||
|
log = "数据库[" + name + "]不存在!" |
||||||
|
print("★[" + endDate + "] " + log) |
||||||
|
print( |
||||||
|
"----------------------------------------------------------------------------") |
||||||
|
return |
||||||
|
|
||||||
|
backup_path = mw.getFatherDir() + '/backup/database/mysql-community' |
||||||
|
if not os.path.exists(backup_path): |
||||||
|
mw.execShell("mkdir -p " + backup_path) |
||||||
|
|
||||||
|
filename = backup_path + "/db_" + name + "_" + \ |
||||||
|
time.strftime('%Y%m%d_%H%M%S', time.localtime()) + ".sql.gz" |
||||||
|
|
||||||
|
mysql_root = mw.M('config').dbPos(db_path, db_name).where( |
||||||
|
"id=?", (1,)).getField('mysql_root') |
||||||
|
|
||||||
|
my_conf_path = db_path + '/etc/my.cnf' |
||||||
|
mycnf = mw.readFile(my_conf_path) |
||||||
|
rep = r"\[mysqldump\]\nuser=root" |
||||||
|
sea = "[mysqldump]\n" |
||||||
|
subStr = sea + "user=root\npassword=" + mysql_root + "\n" |
||||||
|
mycnf = mycnf.replace(sea, subStr) |
||||||
|
if len(mycnf) > 100: |
||||||
|
mw.writeFile(db_path + '/etc/my.cnf', mycnf) |
||||||
|
|
||||||
|
cmd = db_path + "/bin/usr/bin/mysqldump --defaults-file=" + my_conf_path + " --single-transaction -q --default-character-set=utf8mb4 " + name + " | gzip > " + filename |
||||||
|
mw.execShell(cmd) |
||||||
|
|
||||||
|
if not os.path.exists(filename): |
||||||
|
endDate = time.strftime('%Y/%m/%d %X', time.localtime()) |
||||||
|
log = "数据库[" + name + "]备份失败!" |
||||||
|
print("★[" + endDate + "] " + log) |
||||||
|
print( |
||||||
|
"----------------------------------------------------------------------------") |
||||||
|
return |
||||||
|
|
||||||
|
mycnf = mw.readFile(db_path + '/etc/my.cnf') |
||||||
|
mycnf = mycnf.replace(subStr, sea) |
||||||
|
if len(mycnf) > 100: |
||||||
|
mw.writeFile(db_path + '/etc/my.cnf', mycnf) |
||||||
|
|
||||||
|
endDate = time.strftime('%Y/%m/%d %X', time.localtime()) |
||||||
|
outTime = time.time() - startTime |
||||||
|
pid = mw.M('databases').dbPos(db_path, db_name).where('name=?', (name,)).getField('id') |
||||||
|
|
||||||
|
mw.M('backup').add('type,name,pid,filename,add_time,size', (1, os.path.basename(filename), pid, filename, endDate, os.path.getsize(filename))) |
||||||
|
log = "数据库[" + name + "]备份成功,用时[" + str(round(outTime, 2)) + "]秒" |
||||||
|
mw.writeLog('计划任务', log) |
||||||
|
print("★[" + endDate + "] " + log) |
||||||
|
print("|---保留最新的[" + count + "]份备份") |
||||||
|
print("|---文件名:" + filename) |
||||||
|
|
||||||
|
# 清理多余备份 |
||||||
|
backups = mw.M('backup').where('type=? and pid=?', ('1', pid)).field('id,filename').select() |
||||||
|
|
||||||
|
num = len(backups) - int(count) |
||||||
|
if num > 0: |
||||||
|
for backup in backups: |
||||||
|
mw.execShell("rm -f " + backup['filename']) |
||||||
|
mw.M('backup').where('id=?', (backup['id'],)).delete() |
||||||
|
num -= 1 |
||||||
|
print("|---已清理过期备份文件:" + backup['filename']) |
||||||
|
if num < 1: |
||||||
|
break |
||||||
|
|
||||||
|
def backupDatabaseAll(self, save): |
||||||
|
db_path = mw.getServerDir() + '/mysql-community' |
||||||
|
db_name = 'mysql' |
||||||
|
databases = mw.M('databases').dbPos(db_path, db_name).field('name').select() |
||||||
|
for database in databases: |
||||||
|
self.backupDatabase(database['name'], save) |
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__": |
||||||
|
backup = backupTools() |
||||||
|
type = sys.argv[1] |
||||||
|
if type == 'database': |
||||||
|
if sys.argv[2] == 'ALL': |
||||||
|
backup.backupDatabaseAll(sys.argv[3]) |
||||||
|
else: |
||||||
|
backup.backupDatabase(sys.argv[2], sys.argv[3]) |
@ -0,0 +1,132 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
||||||
|
export PATH |
||||||
|
export DEBIAN_FRONTEND=noninteractive |
||||||
|
|
||||||
|
# https://downloads.mysql.com/archives/community/ |
||||||
|
|
||||||
|
# debug |
||||||
|
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 5.7 |
||||||
|
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-apt/index.py start 5.7 |
||||||
|
# /www/server/mysql-apt/bin/usr/sbin/mysqld --defaults-file=/www/server/mysql-apt/etc/my.cnf --daemonize |
||||||
|
# /www/server/mysql-apt/bin/usr/bin/mysql -S /www/server/mysql-apt/mysql.sock -uroot -p |
||||||
|
|
||||||
|
curPath=`pwd` |
||||||
|
rootPath=$(dirname "$curPath") |
||||||
|
rootPath=$(dirname "$rootPath") |
||||||
|
serverPath=$(dirname "$rootPath") |
||||||
|
sysName=`uname` |
||||||
|
|
||||||
|
myDir=${serverPath}/source/mysql-apt |
||||||
|
|
||||||
|
bash ${rootPath}/scripts/getos.sh |
||||||
|
OSNAME=`cat ${rootPath}/data/osname.pl` |
||||||
|
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'` |
||||||
|
|
||||||
|
MYSQL_VER=5.7.39 |
||||||
|
if [ "$OSNAME" == "debian" ];then |
||||||
|
# mysql5.7现在仅有10的编译版 |
||||||
|
VERSION_ID="10" |
||||||
|
fi |
||||||
|
|
||||||
|
if [ "$OSNAME" == "ubuntu" ];then |
||||||
|
# mysql5.7现在仅有18.04的编译版 |
||||||
|
VERSION_ID="18.04" |
||||||
|
fi |
||||||
|
|
||||||
|
ARCH="amd64" |
||||||
|
TMP_ARCH=`arch` |
||||||
|
if [ "$TMP_ARCH" == "x86_64" ];then |
||||||
|
ARCH="amd64" |
||||||
|
elif [ "$TMP_ARCH" == "aarch64" ];then |
||||||
|
ARCH="arm64" |
||||||
|
else |
||||||
|
ARCH="amd64" |
||||||
|
fi |
||||||
|
|
||||||
|
if [ "$ARCH" != "amd64" ];then |
||||||
|
echo "暂时不支持该${ARCH}" |
||||||
|
exit 0 |
||||||
|
fi |
||||||
|
|
||||||
|
SUFFIX_NAME=${MYSQL_VER}-1${OSNAME}${VERSION_ID}_${ARCH} |
||||||
|
|
||||||
|
APT_INSTALL() |
||||||
|
{ |
||||||
|
######## |
||||||
|
mkdir -p $myDir |
||||||
|
mkdir -p $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
wget --no-check-certificate -O ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar https://cdn.mysql.com/archives/mysql-5.7/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
chmod +x ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
cd ${myDir} && tar vxf ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
|
||||||
|
apt update -y |
||||||
|
apt install -y libnuma1 libaio1 libmecab2 |
||||||
|
|
||||||
|
# 安装 |
||||||
|
dpkg -X mysql-common_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
|
||||||
|
dpkg -X mysql-community-client-plugins_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-community-client-core_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-community-client_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-client_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
dpkg -X mysql-community-server-core_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
dpkg -X mysql-community-server_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-server_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
# 测试时可关闭 |
||||||
|
rm -rf $myDir |
||||||
|
####### |
||||||
|
} |
||||||
|
|
||||||
|
APT_UNINSTALL() |
||||||
|
{ |
||||||
|
### |
||||||
|
rm -rf $myDir |
||||||
|
# apt remove -y mysql-server |
||||||
|
### |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
Install_mysql() |
||||||
|
{ |
||||||
|
echo '正在安装脚本文件...' |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_INSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
if [ "$?" == "0" ];then |
||||||
|
mkdir -p $serverPath/mysql-apt |
||||||
|
echo '5.7' > $serverPath/mysql-apt/version.pl |
||||||
|
echo '安装完成' |
||||||
|
else |
||||||
|
echo "暂时不支持该系统" |
||||||
|
fi |
||||||
|
} |
||||||
|
|
||||||
|
Uninstall_mysql() |
||||||
|
{ |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_UNINSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
rm -rf $serverPath/mysql-apt |
||||||
|
echo '卸载完成' |
||||||
|
} |
||||||
|
|
||||||
|
action=$1 |
||||||
|
if [ "${1}" == 'install' ];then |
||||||
|
Install_mysql |
||||||
|
else |
||||||
|
Uninstall_mysql |
||||||
|
fi |
@ -0,0 +1,97 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
||||||
|
export PATH |
||||||
|
export DEBIAN_FRONTEND=noninteractive |
||||||
|
|
||||||
|
# https://downloads.mysql.com/archives/community/ |
||||||
|
|
||||||
|
curPath=`pwd` |
||||||
|
rootPath=$(dirname "$curPath") |
||||||
|
rootPath=$(dirname "$rootPath") |
||||||
|
serverPath=$(dirname "$rootPath") |
||||||
|
sysName=`uname` |
||||||
|
|
||||||
|
myDir=${serverPath}/source/mysql-apt |
||||||
|
|
||||||
|
OS_ARCH=`arch` |
||||||
|
MYSQL_VER=5.7.44 |
||||||
|
SUFFIX_NAME=${MYSQL_VER}-linux-glibc2.12-${OS_ARCH} |
||||||
|
|
||||||
|
if [ "$OS_ARCH" == "x86_64" ] || [ "$OS_ARCH" == "i686" ];then |
||||||
|
echo "ok" |
||||||
|
else |
||||||
|
echo "暂时不支持该${OS_ARCH}" |
||||||
|
exit 0 |
||||||
|
fi |
||||||
|
|
||||||
|
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 5.7 |
||||||
|
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-apt/index.py start 5.7 |
||||||
|
APT_INSTALL() |
||||||
|
{ |
||||||
|
|
||||||
|
######## |
||||||
|
mkdir -p $myDir |
||||||
|
mkdir -p $serverPath/mysql-apt |
||||||
|
|
||||||
|
# Linux - Generic |
||||||
|
if [ ! -f ${myDir}/mysql-${SUFFIX_NAME}.tar.gz ];then |
||||||
|
wget --no-check-certificate -O ${myDir}/mysql-${SUFFIX_NAME}.tar.gz https://cdn.mysql.com/archives/mysql-5.7/mysql-${SUFFIX_NAME}.tar.gz |
||||||
|
fi |
||||||
|
|
||||||
|
if [ -d ${myDir} ];then |
||||||
|
cd ${myDir} && tar -zvxf ${myDir}/mysql-${SUFFIX_NAME}.tar.gz |
||||||
|
cp -rf ${myDir}/mysql-${SUFFIX_NAME}/* $serverPath/mysql-apt |
||||||
|
fi |
||||||
|
|
||||||
|
# 测试时可关闭 |
||||||
|
rm -rf $myDir/mysql-${SUFFIX_NAME} |
||||||
|
####### |
||||||
|
} |
||||||
|
|
||||||
|
APT_UNINSTALL() |
||||||
|
{ |
||||||
|
### |
||||||
|
rm -rf $myDir/mysql-${SUFFIX_NAME} |
||||||
|
### |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
Install_mysql() |
||||||
|
{ |
||||||
|
echo '正在安装脚本文件...' |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_INSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
if [ "$?" == "0" ];then |
||||||
|
mkdir -p $serverPath/mysql-apt |
||||||
|
echo '5.7' > $serverPath/mysql-apt/version.pl |
||||||
|
echo '安装完成' |
||||||
|
else |
||||||
|
echo '5.7' > $serverPath/mysql-apt/version.pl |
||||||
|
echo "暂时不支持该系统" |
||||||
|
fi |
||||||
|
} |
||||||
|
|
||||||
|
Uninstall_mysql() |
||||||
|
{ |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_UNINSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
rm -rf $serverPath/mysql-apt |
||||||
|
echo '卸载完成' |
||||||
|
} |
||||||
|
|
||||||
|
action=$1 |
||||||
|
if [ "${1}" == 'install' ];then |
||||||
|
Install_mysql |
||||||
|
else |
||||||
|
Uninstall_mysql |
||||||
|
fi |
@ -0,0 +1,137 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
||||||
|
export PATH |
||||||
|
export DEBIAN_FRONTEND=noninteractive |
||||||
|
|
||||||
|
# https://downloads.mysql.com/archives/community/ |
||||||
|
|
||||||
|
curPath=`pwd` |
||||||
|
rootPath=$(dirname "$curPath") |
||||||
|
rootPath=$(dirname "$rootPath") |
||||||
|
serverPath=$(dirname "$rootPath") |
||||||
|
sysName=`uname` |
||||||
|
|
||||||
|
myDir=${serverPath}/source/mysql-apt |
||||||
|
|
||||||
|
bash ${rootPath}/scripts/getos.sh |
||||||
|
OSNAME=`cat ${rootPath}/data/osname.pl` |
||||||
|
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'` |
||||||
|
|
||||||
|
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 8.0 |
||||||
|
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-apt/index.py start 8.0 |
||||||
|
|
||||||
|
# 暂时debian12没有标准版,先用11使用 |
||||||
|
# if [ "$OSNAME" == 'debian' ] && [ "$VERSION_ID" == '12' ] ;then |
||||||
|
# echo "暂时不支持该${OSNAME}${VERSION_ID}" |
||||||
|
# exit 1 |
||||||
|
# fi |
||||||
|
|
||||||
|
|
||||||
|
ARCH="amd64" |
||||||
|
TMP_ARCH=`arch` |
||||||
|
if [ "$TMP_ARCH" == "x86_64" ];then |
||||||
|
ARCH="amd64" |
||||||
|
elif [ "$TMP_ARCH" == "aarch64" ];then |
||||||
|
ARCH="arm64" |
||||||
|
else |
||||||
|
ARCH="amd64" |
||||||
|
fi |
||||||
|
|
||||||
|
if [ "$ARCH" != "amd64" ];then |
||||||
|
echo "暂时不支持该${ARCH}" |
||||||
|
exit 1 |
||||||
|
fi |
||||||
|
|
||||||
|
|
||||||
|
MYSQL_VER=8.0.39 |
||||||
|
SUFFIX_NAME=${MYSQL_VER}-1${OSNAME}${VERSION_ID}_${ARCH} |
||||||
|
|
||||||
|
|
||||||
|
# /lib/systemd/system/mysql.service |
||||||
|
# /etc/mysql/my.cnf |
||||||
|
|
||||||
|
APT_INSTALL() |
||||||
|
{ |
||||||
|
######## |
||||||
|
mkdir -p $myDir |
||||||
|
mkdir -p $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
|
||||||
|
mkdir -p /var/run/mysqld |
||||||
|
chown mysql -R /var/run/mysqld |
||||||
|
|
||||||
|
wget --no-check-certificate -O ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar https://cdn.mysql.com/archives/mysql-8.0/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
chmod +x ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
cd ${myDir} && tar vxf ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
|
||||||
|
apt update -y |
||||||
|
apt install -y libnuma1 libaio1 libmecab2 |
||||||
|
|
||||||
|
# 安装 |
||||||
|
dpkg -X mysql-common_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
dpkg -X mysql-community-client-plugins_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-community-client-core_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-community-client_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-client_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
dpkg -X mysql-community-server-core_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
dpkg -X mysql-community-server_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-server_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
# 测试时可关闭 |
||||||
|
rm -rf $myDir |
||||||
|
####### |
||||||
|
} |
||||||
|
|
||||||
|
APT_UNINSTALL() |
||||||
|
{ |
||||||
|
### |
||||||
|
rm -rf $myDir |
||||||
|
# apt remove -y mysql-server |
||||||
|
### |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
Install_mysql() |
||||||
|
{ |
||||||
|
echo '正在安装脚本文件...' |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_INSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
if [ "$?" == "0" ];then |
||||||
|
mkdir -p $serverPath/mysql-apt |
||||||
|
echo '8.0' > $serverPath/mysql-apt/version.pl |
||||||
|
echo '安装完成' |
||||||
|
else |
||||||
|
echo '8.0' > $serverPath/mysql-apt/version.pl |
||||||
|
echo "暂时不支持该系统" |
||||||
|
fi |
||||||
|
} |
||||||
|
|
||||||
|
Uninstall_mysql() |
||||||
|
{ |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_UNINSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
rm -rf $serverPath/mysql-apt |
||||||
|
echo '卸载完成' |
||||||
|
} |
||||||
|
|
||||||
|
action=$1 |
||||||
|
if [ "${1}" == 'install' ];then |
||||||
|
Install_mysql |
||||||
|
else |
||||||
|
Uninstall_mysql |
||||||
|
fi |
@ -0,0 +1,90 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
||||||
|
export PATH |
||||||
|
export DEBIAN_FRONTEND=noninteractive |
||||||
|
|
||||||
|
# https://downloads.mysql.com/archives/community/ |
||||||
|
|
||||||
|
curPath=`pwd` |
||||||
|
rootPath=$(dirname "$curPath") |
||||||
|
rootPath=$(dirname "$rootPath") |
||||||
|
serverPath=$(dirname "$rootPath") |
||||||
|
sysName=`uname` |
||||||
|
|
||||||
|
myDir=${serverPath}/source/mysql-apt |
||||||
|
|
||||||
|
OS_ARCH=`arch` |
||||||
|
MYSQL_VER=8.0.39 |
||||||
|
SUFFIX_NAME=${MYSQL_VER}-linux-glibc2.28-${OS_ARCH} |
||||||
|
|
||||||
|
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 8.0 |
||||||
|
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-apt/index.py start 8.0 |
||||||
|
APT_INSTALL() |
||||||
|
{ |
||||||
|
|
||||||
|
######## |
||||||
|
mkdir -p $myDir |
||||||
|
mkdir -p $serverPath/mysql-apt |
||||||
|
|
||||||
|
# Linux - Generic |
||||||
|
if [ ! -f ${myDir}/mysql-${SUFFIX_NAME}.tar.xz ];then |
||||||
|
wget --no-check-certificate -O ${myDir}/mysql-${SUFFIX_NAME}.tar.xz https://cdn.mysql.com/archives/mysql-8.0/mysql-${SUFFIX_NAME}.tar.xz |
||||||
|
fi |
||||||
|
|
||||||
|
if [ -d ${myDir} ];then |
||||||
|
cd ${myDir} && tar -Jxf ${myDir}/mysql-${SUFFIX_NAME}.tar.xz |
||||||
|
cp -rf ${myDir}/mysql-${SUFFIX_NAME}/* $serverPath/mysql-apt |
||||||
|
fi |
||||||
|
|
||||||
|
# 测试时可关闭 |
||||||
|
rm -rf $myDir/mysql-${SUFFIX_NAME} |
||||||
|
####### |
||||||
|
} |
||||||
|
|
||||||
|
APT_UNINSTALL() |
||||||
|
{ |
||||||
|
### |
||||||
|
rm -rf $myDir/mysql-${SUFFIX_NAME} |
||||||
|
### |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
Install_mysql() |
||||||
|
{ |
||||||
|
echo '正在安装脚本文件...' |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_INSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
if [ "$?" == "0" ];then |
||||||
|
mkdir -p $serverPath/mysql-apt |
||||||
|
echo '8.0' > $serverPath/mysql-apt/version.pl |
||||||
|
echo '安装完成' |
||||||
|
else |
||||||
|
echo '8.0' > $serverPath/mysql-apt/version.pl |
||||||
|
echo "暂时不支持该系统" |
||||||
|
fi |
||||||
|
} |
||||||
|
|
||||||
|
Uninstall_mysql() |
||||||
|
{ |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_UNINSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
rm -rf $serverPath/mysql-apt |
||||||
|
echo '卸载完成' |
||||||
|
} |
||||||
|
|
||||||
|
action=$1 |
||||||
|
if [ "${1}" == 'install' ];then |
||||||
|
Install_mysql |
||||||
|
else |
||||||
|
Uninstall_mysql |
||||||
|
fi |
@ -0,0 +1,137 @@ |
|||||||
|
|
||||||
|
# -*- coding: utf-8 -*- |
||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
||||||
|
export PATH |
||||||
|
export DEBIAN_FRONTEND=noninteractive |
||||||
|
|
||||||
|
# https://downloads.mysql.com/archives/community/ |
||||||
|
|
||||||
|
curPath=`pwd` |
||||||
|
rootPath=$(dirname "$curPath") |
||||||
|
rootPath=$(dirname "$rootPath") |
||||||
|
serverPath=$(dirname "$rootPath") |
||||||
|
sysName=`uname` |
||||||
|
|
||||||
|
myDir=${serverPath}/source/mysql-apt |
||||||
|
|
||||||
|
bash ${rootPath}/scripts/getos.sh |
||||||
|
OSNAME=`cat ${rootPath}/data/osname.pl` |
||||||
|
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'` |
||||||
|
|
||||||
|
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 8.0 |
||||||
|
# cd /www/server/mdserver-web && source bin/activate && python3 plugins/mysql-apt/index.py start |
||||||
|
|
||||||
|
# 暂时debian12没有标准版,先用11使用 |
||||||
|
# if [ "$OSNAME" == 'debian' ] && [ "$VERSION_ID" == '12' ] ;then |
||||||
|
# echo "暂时不支持该${OSNAME}${VERSION_ID}" |
||||||
|
# exit 1 |
||||||
|
# fi |
||||||
|
|
||||||
|
|
||||||
|
ARCH="amd64" |
||||||
|
TMP_ARCH=`arch` |
||||||
|
if [ "$TMP_ARCH" == "x86_64" ];then |
||||||
|
ARCH="amd64" |
||||||
|
elif [ "$TMP_ARCH" == "aarch64" ];then |
||||||
|
ARCH="arm64" |
||||||
|
else |
||||||
|
ARCH="amd64" |
||||||
|
fi |
||||||
|
|
||||||
|
if [ "$ARCH" != "amd64" ];then |
||||||
|
echo "暂时不支持该${ARCH}" |
||||||
|
exit 1 |
||||||
|
fi |
||||||
|
|
||||||
|
|
||||||
|
MYSQL_VER=8.2.0 |
||||||
|
SUFFIX_NAME=${MYSQL_VER}-1${OSNAME}${VERSION_ID}_${ARCH} |
||||||
|
|
||||||
|
|
||||||
|
# /lib/systemd/system/mysql.service |
||||||
|
# /etc/mysql/my.cnf |
||||||
|
|
||||||
|
APT_INSTALL() |
||||||
|
{ |
||||||
|
######## |
||||||
|
mkdir -p $myDir |
||||||
|
mkdir -p $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
mkdir -p /var/run/mysqld |
||||||
|
chown mysql -R /var/run/mysqld |
||||||
|
|
||||||
|
wget --no-check-certificate -O ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar https://cdn.mysql.com/archives/mysql-8.2/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
chmod +x ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
cd ${myDir} && tar vxf ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
|
||||||
|
apt update -y |
||||||
|
apt install -y libnuma1 libaio1 libmecab2 |
||||||
|
|
||||||
|
# 安装 |
||||||
|
dpkg -X mysql-common_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
dpkg -X mysql-community-client-plugins_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-community-client-core_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-community-client_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-client_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
dpkg -X mysql-community-server-core_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
dpkg -X mysql-community-server_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-server_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
# 测试时可关闭 |
||||||
|
rm -rf $myDir |
||||||
|
####### |
||||||
|
} |
||||||
|
|
||||||
|
APT_UNINSTALL() |
||||||
|
{ |
||||||
|
### |
||||||
|
rm -rf $myDir |
||||||
|
# apt remove -y mysql-server |
||||||
|
### |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
Install_mysql() |
||||||
|
{ |
||||||
|
echo '正在安装脚本文件...' |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_INSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
if [ "$?" == "0" ];then |
||||||
|
mkdir -p $serverPath/mysql-apt |
||||||
|
echo '8.2' > $serverPath/mysql-apt/version.pl |
||||||
|
echo '安装完成' |
||||||
|
else |
||||||
|
echo '8.2' > $serverPath/mysql-apt/version.pl |
||||||
|
echo "暂时不支持该系统" |
||||||
|
fi |
||||||
|
} |
||||||
|
|
||||||
|
Uninstall_mysql() |
||||||
|
{ |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_UNINSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
rm -rf $serverPath/mysql-apt |
||||||
|
echo '卸载完成' |
||||||
|
} |
||||||
|
|
||||||
|
action=$1 |
||||||
|
if [ "${1}" == 'install' ];then |
||||||
|
Install_mysql |
||||||
|
else |
||||||
|
Uninstall_mysql |
||||||
|
fi |
@ -0,0 +1,90 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
||||||
|
export PATH |
||||||
|
export DEBIAN_FRONTEND=noninteractive |
||||||
|
|
||||||
|
# https://downloads.mysql.com/archives/community/ |
||||||
|
|
||||||
|
curPath=`pwd` |
||||||
|
rootPath=$(dirname "$curPath") |
||||||
|
rootPath=$(dirname "$rootPath") |
||||||
|
serverPath=$(dirname "$rootPath") |
||||||
|
sysName=`uname` |
||||||
|
|
||||||
|
myDir=${serverPath}/source/mysql-apt |
||||||
|
|
||||||
|
OS_ARCH=`arch` |
||||||
|
MYSQL_VER=8.2.0 |
||||||
|
SUFFIX_NAME=${MYSQL_VER}-linux-glibc2.28-${OS_ARCH} |
||||||
|
|
||||||
|
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 8.2 |
||||||
|
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-apt/index.py start 8.2 |
||||||
|
APT_INSTALL() |
||||||
|
{ |
||||||
|
|
||||||
|
######## |
||||||
|
mkdir -p $myDir |
||||||
|
mkdir -p $serverPath/mysql-apt |
||||||
|
|
||||||
|
# Linux - Generic |
||||||
|
if [ ! -f ${myDir}/mysql-${SUFFIX_NAME}.tar.xz ];then |
||||||
|
wget --no-check-certificate -O ${myDir}/mysql-${SUFFIX_NAME}.tar.xz https://cdn.mysql.com/archives/mysql-8.2/mysql-${SUFFIX_NAME}.tar.xz |
||||||
|
fi |
||||||
|
|
||||||
|
if [ -d ${myDir} ];then |
||||||
|
cd ${myDir} && tar -Jxf ${myDir}/mysql-${SUFFIX_NAME}.tar.xz |
||||||
|
cp -rf ${myDir}/mysql-${SUFFIX_NAME}/* $serverPath/mysql-apt |
||||||
|
fi |
||||||
|
|
||||||
|
# 测试时可关闭 |
||||||
|
rm -rf $myDir/mysql-${SUFFIX_NAME} |
||||||
|
####### |
||||||
|
} |
||||||
|
|
||||||
|
APT_UNINSTALL() |
||||||
|
{ |
||||||
|
### |
||||||
|
rm -rf $myDir/mysql-${SUFFIX_NAME} |
||||||
|
### |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
Install_mysql() |
||||||
|
{ |
||||||
|
echo '正在安装脚本文件...' |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_INSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
if [ "$?" == "0" ];then |
||||||
|
mkdir -p $serverPath/mysql-apt |
||||||
|
echo '8.2' > $serverPath/mysql-apt/version.pl |
||||||
|
echo '安装完成' |
||||||
|
else |
||||||
|
echo '8.2' > $serverPath/mysql-apt/version.pl |
||||||
|
echo "暂时不支持该系统" |
||||||
|
fi |
||||||
|
} |
||||||
|
|
||||||
|
Uninstall_mysql() |
||||||
|
{ |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_UNINSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
rm -rf $serverPath/mysql-apt |
||||||
|
echo '卸载完成' |
||||||
|
} |
||||||
|
|
||||||
|
action=$1 |
||||||
|
if [ "${1}" == 'install' ];then |
||||||
|
Install_mysql |
||||||
|
else |
||||||
|
Uninstall_mysql |
||||||
|
fi |
@ -0,0 +1,135 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
||||||
|
export PATH |
||||||
|
export DEBIAN_FRONTEND=noninteractive |
||||||
|
|
||||||
|
# https://downloads.mysql.com/archives/community/ |
||||||
|
|
||||||
|
curPath=`pwd` |
||||||
|
rootPath=$(dirname "$curPath") |
||||||
|
rootPath=$(dirname "$rootPath") |
||||||
|
serverPath=$(dirname "$rootPath") |
||||||
|
sysName=`uname` |
||||||
|
|
||||||
|
myDir=${serverPath}/source/mysql-apt |
||||||
|
|
||||||
|
bash ${rootPath}/scripts/getos.sh |
||||||
|
OSNAME=`cat ${rootPath}/data/osname.pl` |
||||||
|
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'` |
||||||
|
|
||||||
|
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 8.0 |
||||||
|
|
||||||
|
# 暂时debian12没有标准版,先用11使用 |
||||||
|
# if [ "$OSNAME" == 'debian' ] && [ "$VERSION_ID" == '12' ] ;then |
||||||
|
# echo "暂时不支持该${OSNAME}${VERSION_ID}" |
||||||
|
# exit 1 |
||||||
|
# fi |
||||||
|
|
||||||
|
|
||||||
|
ARCH="amd64" |
||||||
|
TMP_ARCH=`arch` |
||||||
|
if [ "$TMP_ARCH" == "x86_64" ];then |
||||||
|
ARCH="amd64" |
||||||
|
elif [ "$TMP_ARCH" == "aarch64" ];then |
||||||
|
ARCH="arm64" |
||||||
|
else |
||||||
|
ARCH="amd64" |
||||||
|
fi |
||||||
|
|
||||||
|
if [ "$ARCH" != "amd64" ];then |
||||||
|
echo "暂时不支持该${ARCH}" |
||||||
|
exit 1 |
||||||
|
fi |
||||||
|
|
||||||
|
|
||||||
|
MYSQL_VER=8.3.0 |
||||||
|
SUFFIX_NAME=${MYSQL_VER}-1${OSNAME}${VERSION_ID}_${ARCH} |
||||||
|
|
||||||
|
|
||||||
|
# /lib/systemd/system/mysql.service |
||||||
|
# /etc/mysql/my.cnf |
||||||
|
|
||||||
|
APT_INSTALL() |
||||||
|
{ |
||||||
|
######## |
||||||
|
mkdir -p $myDir |
||||||
|
mkdir -p $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
mkdir -p /var/run/mysqld |
||||||
|
chown mysql -R /var/run/mysqld |
||||||
|
|
||||||
|
wget --no-check-certificate -O ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar https://cdn.mysql.com/archives/mysql-8.3/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
chmod +x ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
cd ${myDir} && tar vxf ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
|
||||||
|
apt update -y |
||||||
|
apt install -y libnuma1 libaio1 libmecab2 |
||||||
|
|
||||||
|
# 安装 |
||||||
|
dpkg -X mysql-common_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
dpkg -X mysql-community-client-plugins_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-community-client-core_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-community-client_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-client_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
dpkg -X mysql-community-server-core_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
dpkg -X mysql-community-server_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-server_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
# 测试时可关闭 |
||||||
|
rm -rf $myDir |
||||||
|
####### |
||||||
|
} |
||||||
|
|
||||||
|
APT_UNINSTALL() |
||||||
|
{ |
||||||
|
### |
||||||
|
rm -rf $myDir |
||||||
|
# apt remove -y mysql-server |
||||||
|
### |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
Install_mysql() |
||||||
|
{ |
||||||
|
echo '正在安装脚本文件...' |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_INSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
if [ "$?" == "0" ];then |
||||||
|
mkdir -p $serverPath/mysql-apt |
||||||
|
echo '8.3' > $serverPath/mysql-apt/version.pl |
||||||
|
echo '安装完成' |
||||||
|
else |
||||||
|
echo '8.3' > $serverPath/mysql-apt/version.pl |
||||||
|
echo "暂时不支持该系统" |
||||||
|
fi |
||||||
|
} |
||||||
|
|
||||||
|
Uninstall_mysql() |
||||||
|
{ |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_UNINSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
rm -rf $serverPath/mysql-apt |
||||||
|
echo '卸载完成' |
||||||
|
} |
||||||
|
|
||||||
|
action=$1 |
||||||
|
if [ "${1}" == 'install' ];then |
||||||
|
Install_mysql |
||||||
|
else |
||||||
|
Uninstall_mysql |
||||||
|
fi |
@ -0,0 +1,90 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
||||||
|
export PATH |
||||||
|
export DEBIAN_FRONTEND=noninteractive |
||||||
|
|
||||||
|
# https://downloads.mysql.com/archives/community/ |
||||||
|
|
||||||
|
curPath=`pwd` |
||||||
|
rootPath=$(dirname "$curPath") |
||||||
|
rootPath=$(dirname "$rootPath") |
||||||
|
serverPath=$(dirname "$rootPath") |
||||||
|
sysName=`uname` |
||||||
|
|
||||||
|
myDir=${serverPath}/source/mysql-apt |
||||||
|
|
||||||
|
OS_ARCH=`arch` |
||||||
|
MYSQL_VER=8.3.0 |
||||||
|
SUFFIX_NAME=${MYSQL_VER}-linux-glibc2.28-${OS_ARCH} |
||||||
|
|
||||||
|
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 8.3 |
||||||
|
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-apt/index.py start 8.3 |
||||||
|
APT_INSTALL() |
||||||
|
{ |
||||||
|
|
||||||
|
######## |
||||||
|
mkdir -p $myDir |
||||||
|
mkdir -p $serverPath/mysql-apt |
||||||
|
|
||||||
|
# Linux - Generic |
||||||
|
if [ ! -f ${myDir}/mysql-${SUFFIX_NAME}.tar.xz ];then |
||||||
|
wget --no-check-certificate -O ${myDir}/mysql-${SUFFIX_NAME}.tar.xz https://cdn.mysql.com/archives/mysql-8.3/mysql-${SUFFIX_NAME}.tar.xz |
||||||
|
fi |
||||||
|
|
||||||
|
if [ -d ${myDir} ];then |
||||||
|
cd ${myDir} && tar -Jxf ${myDir}/mysql-${SUFFIX_NAME}.tar.xz |
||||||
|
cp -rf ${myDir}/mysql-${SUFFIX_NAME}/* $serverPath/mysql-apt |
||||||
|
fi |
||||||
|
|
||||||
|
# 测试时可关闭 |
||||||
|
rm -rf $myDir/mysql-${SUFFIX_NAME} |
||||||
|
####### |
||||||
|
} |
||||||
|
|
||||||
|
APT_UNINSTALL() |
||||||
|
{ |
||||||
|
### |
||||||
|
rm -rf $myDir/mysql-${SUFFIX_NAME} |
||||||
|
### |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
Install_mysql() |
||||||
|
{ |
||||||
|
echo '正在安装脚本文件...' |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_INSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
if [ "$?" == "0" ];then |
||||||
|
mkdir -p $serverPath/mysql-apt |
||||||
|
echo '8.3' > $serverPath/mysql-apt/version.pl |
||||||
|
echo '安装完成' |
||||||
|
else |
||||||
|
echo '8.3' > $serverPath/mysql-apt/version.pl |
||||||
|
echo "暂时不支持该系统" |
||||||
|
fi |
||||||
|
} |
||||||
|
|
||||||
|
Uninstall_mysql() |
||||||
|
{ |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_UNINSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
rm -rf $serverPath/mysql-apt |
||||||
|
echo '卸载完成' |
||||||
|
} |
||||||
|
|
||||||
|
action=$1 |
||||||
|
if [ "${1}" == 'install' ];then |
||||||
|
Install_mysql |
||||||
|
else |
||||||
|
Uninstall_mysql |
||||||
|
fi |
@ -0,0 +1,137 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
||||||
|
export PATH |
||||||
|
export DEBIAN_FRONTEND=noninteractive |
||||||
|
|
||||||
|
# https://downloads.mysql.com/archives/community/ |
||||||
|
|
||||||
|
curPath=`pwd` |
||||||
|
rootPath=$(dirname "$curPath") |
||||||
|
rootPath=$(dirname "$rootPath") |
||||||
|
serverPath=$(dirname "$rootPath") |
||||||
|
sysName=`uname` |
||||||
|
|
||||||
|
myDir=${serverPath}/source/mysql-apt |
||||||
|
|
||||||
|
bash ${rootPath}/scripts/getos.sh |
||||||
|
OSNAME=`cat ${rootPath}/data/osname.pl` |
||||||
|
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'` |
||||||
|
|
||||||
|
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 8.4 |
||||||
|
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-apt/index.py start 8.4 |
||||||
|
|
||||||
|
if [ "$OSNAME" == 'debian' ] && [ "$VERSION_ID" -lt '12' ] ;then |
||||||
|
VERSION_ID="12" |
||||||
|
fi |
||||||
|
|
||||||
|
|
||||||
|
ARCH="amd64" |
||||||
|
TMP_ARCH=`arch` |
||||||
|
if [ "$TMP_ARCH" == "x86_64" ];then |
||||||
|
ARCH="amd64" |
||||||
|
elif [ "$TMP_ARCH" == "aarch64" ];then |
||||||
|
ARCH="arm64" |
||||||
|
else |
||||||
|
ARCH="amd64" |
||||||
|
fi |
||||||
|
|
||||||
|
if [ "$ARCH" != "amd64" ];then |
||||||
|
echo "暂时不支持该${ARCH}" |
||||||
|
exit 1 |
||||||
|
fi |
||||||
|
|
||||||
|
|
||||||
|
MYSQL_VER=8.4.2 |
||||||
|
SUFFIX_NAME=${MYSQL_VER}-1${OSNAME}${VERSION_ID}_${ARCH} |
||||||
|
|
||||||
|
|
||||||
|
# /lib/systemd/system/mysql.service |
||||||
|
# /etc/mysql/my.cnf |
||||||
|
|
||||||
|
APT_INSTALL() |
||||||
|
{ |
||||||
|
######## |
||||||
|
mkdir -p $myDir |
||||||
|
mkdir -p $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
mkdir -p /var/run/mysqld |
||||||
|
chown mysql -R /var/run/mysqld |
||||||
|
|
||||||
|
# https://cdn.mysql.com/archives/mysql-8.4/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
# https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
|
||||||
|
wget --no-check-certificate -O ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
chmod +x ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
cd ${myDir} && tar vxf ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
|
||||||
|
apt update -y |
||||||
|
apt install -y libnuma1 libaio1 libmecab2 |
||||||
|
|
||||||
|
# 安装 |
||||||
|
dpkg -X mysql-common_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
dpkg -X mysql-community-client-plugins_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-community-client-core_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-community-client_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-client_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
dpkg -X mysql-community-server-core_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
dpkg -X mysql-community-server_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-server_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
# 测试时可关闭 |
||||||
|
rm -rf $myDir |
||||||
|
####### |
||||||
|
} |
||||||
|
|
||||||
|
APT_UNINSTALL() |
||||||
|
{ |
||||||
|
### |
||||||
|
rm -rf $myDir |
||||||
|
# apt remove -y mysql-server |
||||||
|
### |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
Install_mysql() |
||||||
|
{ |
||||||
|
echo '正在安装脚本文件...' |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_INSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
if [ "$?" == "0" ];then |
||||||
|
mkdir -p $serverPath/mysql-apt |
||||||
|
echo '8.4' > $serverPath/mysql-apt/version.pl |
||||||
|
echo '安装完成' |
||||||
|
else |
||||||
|
echo '8.4' > $serverPath/mysql-apt/version.pl |
||||||
|
echo "暂时不支持该系统" |
||||||
|
fi |
||||||
|
} |
||||||
|
|
||||||
|
Uninstall_mysql() |
||||||
|
{ |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_UNINSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
rm -rf $serverPath/mysql-apt |
||||||
|
echo '卸载完成' |
||||||
|
} |
||||||
|
|
||||||
|
action=$1 |
||||||
|
if [ "${1}" == 'install' ];then |
||||||
|
Install_mysql |
||||||
|
else |
||||||
|
Uninstall_mysql |
||||||
|
fi |
@ -0,0 +1,93 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
||||||
|
export PATH |
||||||
|
export DEBIAN_FRONTEND=noninteractive |
||||||
|
|
||||||
|
# https://downloads.mysql.com/archives/community/ |
||||||
|
|
||||||
|
curPath=`pwd` |
||||||
|
rootPath=$(dirname "$curPath") |
||||||
|
rootPath=$(dirname "$rootPath") |
||||||
|
serverPath=$(dirname "$rootPath") |
||||||
|
sysName=`uname` |
||||||
|
|
||||||
|
myDir=${serverPath}/source/mysql-apt |
||||||
|
|
||||||
|
OS_ARCH=`arch` |
||||||
|
MYSQL_VER=8.4.2 |
||||||
|
SUFFIX_NAME=${MYSQL_VER}-linux-glibc2.28-${OS_ARCH} |
||||||
|
|
||||||
|
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 8.4 |
||||||
|
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-apt/index.py start 8.4 |
||||||
|
APT_INSTALL() |
||||||
|
{ |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
######## |
||||||
|
mkdir -p $myDir |
||||||
|
mkdir -p $serverPath/mysql-apt |
||||||
|
|
||||||
|
# Linux - Generic |
||||||
|
# https://cdn.mysql.com/archives/mysql-8.4/mysql-8.4.2-linux-glibc2.28-x86_64.tar.xz |
||||||
|
if [ ! -f ${myDir}/mysql-${SUFFIX_NAME}.tar.xz ];then |
||||||
|
wget --no-check-certificate -O ${myDir}/mysql-${SUFFIX_NAME}.tar.xz https://cdn.mysql.com/archives/mysql-8.4/mysql-${SUFFIX_NAME}.tar.xz |
||||||
|
fi |
||||||
|
|
||||||
|
if [ -d ${myDir} ];then |
||||||
|
cd ${myDir} && tar -Jxf ${myDir}/mysql-${SUFFIX_NAME}.tar.xz |
||||||
|
cp -rf ${myDir}/mysql-${SUFFIX_NAME}/* $serverPath/mysql-apt |
||||||
|
fi |
||||||
|
|
||||||
|
# 测试时可关闭 |
||||||
|
rm -rf $myDir/mysql-${SUFFIX_NAME} |
||||||
|
####### |
||||||
|
} |
||||||
|
|
||||||
|
APT_UNINSTALL() |
||||||
|
{ |
||||||
|
### |
||||||
|
rm -rf $myDir/mysql-${SUFFIX_NAME} |
||||||
|
### |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
Install_mysql() |
||||||
|
{ |
||||||
|
echo '正在安装脚本文件...' |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_INSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
if [ "$?" == "0" ];then |
||||||
|
mkdir -p $serverPath/mysql-apt |
||||||
|
echo '8.4' > $serverPath/mysql-apt/version.pl |
||||||
|
echo '安装完成' |
||||||
|
else |
||||||
|
echo '8.4' > $serverPath/mysql-apt/version.pl |
||||||
|
echo "暂时不支持该系统" |
||||||
|
fi |
||||||
|
} |
||||||
|
|
||||||
|
Uninstall_mysql() |
||||||
|
{ |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_UNINSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
rm -rf $serverPath/mysql-apt |
||||||
|
echo '卸载完成' |
||||||
|
} |
||||||
|
|
||||||
|
action=$1 |
||||||
|
if [ "${1}" == 'install' ];then |
||||||
|
Install_mysql |
||||||
|
else |
||||||
|
Uninstall_mysql |
||||||
|
fi |
@ -0,0 +1,138 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
||||||
|
export PATH |
||||||
|
export DEBIAN_FRONTEND=noninteractive |
||||||
|
|
||||||
|
# https://downloads.mysql.com/archives/community/ |
||||||
|
|
||||||
|
curPath=`pwd` |
||||||
|
rootPath=$(dirname "$curPath") |
||||||
|
rootPath=$(dirname "$rootPath") |
||||||
|
serverPath=$(dirname "$rootPath") |
||||||
|
sysName=`uname` |
||||||
|
|
||||||
|
myDir=${serverPath}/source/mysql-apt |
||||||
|
|
||||||
|
bash ${rootPath}/scripts/getos.sh |
||||||
|
OSNAME=`cat ${rootPath}/data/osname.pl` |
||||||
|
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'` |
||||||
|
|
||||||
|
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 9.0 |
||||||
|
|
||||||
|
# 暂时debian12没有标准版,先用11使用 |
||||||
|
if [ "$OSNAME" == 'debian' ] && [ "$VERSION_ID" -lt '12' ] ;then |
||||||
|
VERSION_ID="12" |
||||||
|
fi |
||||||
|
|
||||||
|
|
||||||
|
ARCH="amd64" |
||||||
|
TMP_ARCH=`arch` |
||||||
|
if [ "$TMP_ARCH" == "x86_64" ];then |
||||||
|
ARCH="amd64" |
||||||
|
elif [ "$TMP_ARCH" == "aarch64" ];then |
||||||
|
ARCH="arm64" |
||||||
|
else |
||||||
|
ARCH="amd64" |
||||||
|
fi |
||||||
|
|
||||||
|
if [ "$ARCH" != "amd64" ];then |
||||||
|
echo "暂时不支持该${ARCH}" |
||||||
|
exit 1 |
||||||
|
fi |
||||||
|
|
||||||
|
|
||||||
|
MYSQL_VER=9.0.1 |
||||||
|
SUFFIX_NAME=${MYSQL_VER}-1${OSNAME}${VERSION_ID}_${ARCH} |
||||||
|
|
||||||
|
|
||||||
|
# /lib/systemd/system/mysql.service |
||||||
|
# /etc/mysql/my.cnf |
||||||
|
|
||||||
|
APT_INSTALL() |
||||||
|
{ |
||||||
|
######## |
||||||
|
mkdir -p $myDir |
||||||
|
mkdir -p $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
mkdir -p /var/run/mysqld |
||||||
|
chown mysql -R /var/run/mysqld |
||||||
|
|
||||||
|
# https://dev.mysql.com/get/Downloads/MySQL-9.0/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
# https://cdn.mysql.com/archives/mysql-9.0/mysql-server_9.0.1-1debian12_amd64.deb-bundle.tar |
||||||
|
|
||||||
|
wget --no-check-certificate -O ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar https://cdn.mysql.com/archives/mysql-9.0/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
# wget --no-check-certificate -O ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar https://dev.mysql.com/get/Downloads/MySQL-9.1/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
chmod +x ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
cd ${myDir} && tar vxf ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
|
||||||
|
apt update -y |
||||||
|
apt install -y libnuma1 libaio1 libmecab2 |
||||||
|
|
||||||
|
# 安装 |
||||||
|
dpkg -X mysql-common_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
dpkg -X mysql-community-client-plugins_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-community-client-core_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-community-client_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-client_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
dpkg -X mysql-community-server-core_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
dpkg -X mysql-community-server_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-server_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
# 测试时可关闭 |
||||||
|
rm -rf $myDir |
||||||
|
####### |
||||||
|
} |
||||||
|
|
||||||
|
APT_UNINSTALL() |
||||||
|
{ |
||||||
|
### |
||||||
|
rm -rf $myDir |
||||||
|
# apt remove -y mysql-server |
||||||
|
### |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
Install_mysql() |
||||||
|
{ |
||||||
|
echo '正在安装脚本文件...' |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_INSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
if [ "$?" == "0" ];then |
||||||
|
mkdir -p $serverPath/mysql-apt |
||||||
|
echo '9.0' > $serverPath/mysql-apt/version.pl |
||||||
|
echo '安装完成' |
||||||
|
else |
||||||
|
echo '9.0' > $serverPath/mysql-apt/version.pl |
||||||
|
echo "暂时不支持该系统" |
||||||
|
fi |
||||||
|
} |
||||||
|
|
||||||
|
Uninstall_mysql() |
||||||
|
{ |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_UNINSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
rm -rf $serverPath/mysql-apt |
||||||
|
echo '卸载完成' |
||||||
|
} |
||||||
|
|
||||||
|
action=$1 |
||||||
|
if [ "${1}" == 'install' ];then |
||||||
|
Install_mysql |
||||||
|
else |
||||||
|
Uninstall_mysql |
||||||
|
fi |
@ -0,0 +1,90 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
||||||
|
export PATH |
||||||
|
export DEBIAN_FRONTEND=noninteractive |
||||||
|
|
||||||
|
# https://downloads.mysql.com/archives/community/ |
||||||
|
curPath=`pwd` |
||||||
|
rootPath=$(dirname "$curPath") |
||||||
|
rootPath=$(dirname "$rootPath") |
||||||
|
serverPath=$(dirname "$rootPath") |
||||||
|
sysName=`uname` |
||||||
|
|
||||||
|
myDir=${serverPath}/source/mysql-apt |
||||||
|
|
||||||
|
OS_ARCH=`arch` |
||||||
|
MYSQL_VER=9.0.1 |
||||||
|
SUFFIX_NAME=${MYSQL_VER}-linux-glibc2.28-${OS_ARCH} |
||||||
|
|
||||||
|
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 9.0 |
||||||
|
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-apt/index.py start 9.0 |
||||||
|
APT_INSTALL() |
||||||
|
{ |
||||||
|
|
||||||
|
######## |
||||||
|
mkdir -p $myDir |
||||||
|
mkdir -p $serverPath/mysql-apt |
||||||
|
|
||||||
|
# Linux - Generic |
||||||
|
# https://cdn.mysql.com/archives/mysql-9.0/mysql-9.0.1-linux-glibc2.28-x86_64.tar.xz |
||||||
|
if [ ! -f ${myDir}/mysql-${SUFFIX_NAME}.tar.xz ];then |
||||||
|
wget --no-check-certificate -O ${myDir}/mysql-${SUFFIX_NAME}.tar.xz https://cdn.mysql.com/archives/mysql-9.0/mysql-${SUFFIX_NAME}.tar.xz |
||||||
|
fi |
||||||
|
|
||||||
|
if [ -d ${myDir} ];then |
||||||
|
cd ${myDir} && tar -Jxf ${myDir}/mysql-${SUFFIX_NAME}.tar.xz |
||||||
|
cp -rf ${myDir}/mysql-${SUFFIX_NAME}/* $serverPath/mysql-apt |
||||||
|
fi |
||||||
|
|
||||||
|
# 测试时可关闭 |
||||||
|
rm -rf $myDir/mysql-${SUFFIX_NAME} |
||||||
|
####### |
||||||
|
} |
||||||
|
|
||||||
|
APT_UNINSTALL() |
||||||
|
{ |
||||||
|
### |
||||||
|
rm -rf $myDir/mysql-${SUFFIX_NAME} |
||||||
|
### |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
Install_mysql() |
||||||
|
{ |
||||||
|
echo '正在安装脚本文件...' |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_INSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
if [ "$?" == "0" ];then |
||||||
|
mkdir -p $serverPath/mysql-apt |
||||||
|
echo '9.0' > $serverPath/mysql-apt/version.pl |
||||||
|
echo '安装完成' |
||||||
|
else |
||||||
|
echo '9.0' > $serverPath/mysql-apt/version.pl |
||||||
|
echo "暂时不支持该系统" |
||||||
|
fi |
||||||
|
} |
||||||
|
|
||||||
|
Uninstall_mysql() |
||||||
|
{ |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_UNINSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
rm -rf $serverPath/mysql-apt |
||||||
|
echo '卸载完成' |
||||||
|
} |
||||||
|
|
||||||
|
action=$1 |
||||||
|
if [ "${1}" == 'install' ];then |
||||||
|
Install_mysql |
||||||
|
else |
||||||
|
Uninstall_mysql |
||||||
|
fi |
@ -0,0 +1,144 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
||||||
|
export PATH |
||||||
|
export DEBIAN_FRONTEND=noninteractive |
||||||
|
|
||||||
|
# https://downloads.mysql.com/archives/community/ |
||||||
|
|
||||||
|
curPath=`pwd` |
||||||
|
rootPath=$(dirname "$curPath") |
||||||
|
rootPath=$(dirname "$rootPath") |
||||||
|
serverPath=$(dirname "$rootPath") |
||||||
|
sysName=`uname` |
||||||
|
|
||||||
|
myDir=${serverPath}/source/mysql-apt |
||||||
|
|
||||||
|
bash ${rootPath}/scripts/getos.sh |
||||||
|
OSNAME=`cat ${rootPath}/data/osname.pl` |
||||||
|
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'` |
||||||
|
|
||||||
|
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-apt/index.py start 9.1 |
||||||
|
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 9.1 |
||||||
|
|
||||||
|
#x-faq |
||||||
|
# strings /lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIB |
||||||
|
|
||||||
|
# debian12 |
||||||
|
if [ "$OSNAME" == 'debian' ] && [ "$VERSION_ID" -lt '12' ] ;then |
||||||
|
VERSION_ID="12" |
||||||
|
fi |
||||||
|
|
||||||
|
|
||||||
|
ARCH="amd64" |
||||||
|
TMP_ARCH=`arch` |
||||||
|
if [ "$TMP_ARCH" == "x86_64" ];then |
||||||
|
ARCH="amd64" |
||||||
|
elif [ "$TMP_ARCH" == "aarch64" ];then |
||||||
|
ARCH="arm64" |
||||||
|
else |
||||||
|
ARCH="amd64" |
||||||
|
fi |
||||||
|
|
||||||
|
if [ "$ARCH" != "amd64" ];then |
||||||
|
echo "暂时不支持该${ARCH}" |
||||||
|
exit 1 |
||||||
|
fi |
||||||
|
|
||||||
|
|
||||||
|
MYSQL_VER=9.1.0 |
||||||
|
SUFFIX_NAME=${MYSQL_VER}-1${OSNAME}${VERSION_ID}_${ARCH} |
||||||
|
|
||||||
|
|
||||||
|
# /lib/systemd/system/mysql.service |
||||||
|
# /etc/mysql/my.cnf |
||||||
|
|
||||||
|
APT_INSTALL() |
||||||
|
{ |
||||||
|
|
||||||
|
cd ${rootPath}/plugins/php/lib && /bin/bash openssl_30.sh |
||||||
|
|
||||||
|
######## |
||||||
|
mkdir -p $myDir |
||||||
|
mkdir -p $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
mkdir -p /var/run/mysqld |
||||||
|
chown mysql -R /var/run/mysqld |
||||||
|
|
||||||
|
# https://cdn.mysql.com/archives/mysql-9.1/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
# https://dev.mysql.com/get/Downloads/MySQL-9.1/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
|
||||||
|
wget --no-check-certificate -O ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar https://dev.mysql.com/get/Downloads/MySQL-9.1/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
chmod +x ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
cd ${myDir} && tar vxf ${myDir}/mysql-server_${SUFFIX_NAME}.deb-bundle.tar |
||||||
|
|
||||||
|
apt update -y |
||||||
|
apt install -y libnuma1 libaio1 libmecab2 |
||||||
|
|
||||||
|
# 安装 |
||||||
|
dpkg -X mysql-common_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
dpkg -X mysql-community-client-plugins_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-community-client-core_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-community-client_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-client_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
dpkg -X mysql-community-server-core_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
dpkg -X mysql-community-server_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
dpkg -X mysql-server_${SUFFIX_NAME}.deb $serverPath/mysql-apt/bin |
||||||
|
|
||||||
|
# 测试时可关闭 |
||||||
|
rm -rf $myDir |
||||||
|
####### |
||||||
|
} |
||||||
|
|
||||||
|
APT_UNINSTALL() |
||||||
|
{ |
||||||
|
### |
||||||
|
rm -rf $myDir |
||||||
|
# apt remove -y mysql-server |
||||||
|
### |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
Install_mysql() |
||||||
|
{ |
||||||
|
echo '正在安装脚本文件...' |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_INSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
if [ "$?" == "0" ];then |
||||||
|
mkdir -p $serverPath/mysql-apt |
||||||
|
echo '9.1' > $serverPath/mysql-apt/version.pl |
||||||
|
echo '安装完成' |
||||||
|
else |
||||||
|
echo '9.1' > $serverPath/mysql-apt/version.pl |
||||||
|
echo "暂时不支持该系统" |
||||||
|
fi |
||||||
|
} |
||||||
|
|
||||||
|
Uninstall_mysql() |
||||||
|
{ |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_UNINSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
rm -rf $serverPath/mysql-apt |
||||||
|
echo '卸载完成' |
||||||
|
} |
||||||
|
|
||||||
|
action=$1 |
||||||
|
if [ "${1}" == 'install' ];then |
||||||
|
Install_mysql |
||||||
|
else |
||||||
|
Uninstall_mysql |
||||||
|
fi |
@ -0,0 +1,93 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
||||||
|
export PATH |
||||||
|
export DEBIAN_FRONTEND=noninteractive |
||||||
|
|
||||||
|
# https://downloads.mysql.com/archives/community/ |
||||||
|
|
||||||
|
curPath=`pwd` |
||||||
|
rootPath=$(dirname "$curPath") |
||||||
|
rootPath=$(dirname "$rootPath") |
||||||
|
serverPath=$(dirname "$rootPath") |
||||||
|
sysName=`uname` |
||||||
|
|
||||||
|
myDir=${serverPath}/source/mysql-apt |
||||||
|
|
||||||
|
OS_ARCH=`arch` |
||||||
|
MYSQL_VER=9.1.0 |
||||||
|
SUFFIX_NAME=${MYSQL_VER}-linux-glibc2.28-${OS_ARCH} |
||||||
|
|
||||||
|
# cd /www/server/mdserver-web/plugins/mysql-apt && bash install.sh install 9.1 |
||||||
|
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql-apt/index.py start 9.1 |
||||||
|
APT_INSTALL() |
||||||
|
{ |
||||||
|
|
||||||
|
######## |
||||||
|
mkdir -p $myDir |
||||||
|
mkdir -p $serverPath/mysql-apt |
||||||
|
|
||||||
|
# Linux - Generic |
||||||
|
# https://cdn.mysql.com/archives/mysql-8.4/mysql-8.4.2-linux-glibc2.28-x86_64.tar.xz |
||||||
|
# https://cdn.mysql.com/Downloads/MySQL-9.1/mysql-${SUFFIX_NAME}.tar.xz |
||||||
|
if [ ! -f ${myDir}/mysql-${SUFFIX_NAME}.tar.xz ];then |
||||||
|
wget --no-check-certificate -O ${myDir}/mysql-${SUFFIX_NAME}.tar.xz https://cdn.mysql.com/Downloads/MySQL-9.1/mysql-${SUFFIX_NAME}.tar.xz |
||||||
|
fi |
||||||
|
|
||||||
|
if [ -d ${myDir} ];then |
||||||
|
cd ${myDir} && tar -Jxf ${myDir}/mysql-${SUFFIX_NAME}.tar.xz |
||||||
|
cp -rf ${myDir}/mysql-${SUFFIX_NAME}/* $serverPath/mysql-apt |
||||||
|
fi |
||||||
|
|
||||||
|
# 测试时可关闭 |
||||||
|
rm -rf $myDir/mysql-${SUFFIX_NAME} |
||||||
|
####### |
||||||
|
} |
||||||
|
|
||||||
|
APT_UNINSTALL() |
||||||
|
{ |
||||||
|
### |
||||||
|
rm -rf $myDir/mysql-${SUFFIX_NAME} |
||||||
|
# apt remove -y mysql-server |
||||||
|
### |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
Install_mysql() |
||||||
|
{ |
||||||
|
echo '正在安装脚本文件...' |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_INSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
if [ "$?" == "0" ];then |
||||||
|
mkdir -p $serverPath/mysql-apt |
||||||
|
echo '9.1' > $serverPath/mysql-apt/version.pl |
||||||
|
echo '安装完成' |
||||||
|
else |
||||||
|
echo '9.1' > $serverPath/mysql-apt/version.pl |
||||||
|
echo "暂时不支持该系统" |
||||||
|
fi |
||||||
|
} |
||||||
|
|
||||||
|
Uninstall_mysql() |
||||||
|
{ |
||||||
|
|
||||||
|
isApt=`which apt` |
||||||
|
if [ "$isApt" != "" ];then |
||||||
|
APT_UNINSTALL |
||||||
|
fi |
||||||
|
|
||||||
|
rm -rf $serverPath/mysql-apt |
||||||
|
echo '卸载完成' |
||||||
|
} |
||||||
|
|
||||||
|
action=$1 |
||||||
|
if [ "${1}" == 'install' ];then |
||||||
|
Install_mysql |
||||||
|
else |
||||||
|
Uninstall_mysql |
||||||
|
fi |
Loading…
Reference in new issue