MySQL8轻松新建管理多实例

# For advice on how to change settings please see

# http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html

#

# Remove leading # and set to the amount of RAM for the most important data

# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.

#

# Remove the leading "# " to disable binary logging

# Binary logging captures changes between backups and is enabled by

# default. It's default setting is log_bin=binlog

# disable_log_bin

#

# Remove leading # to set options mainly useful for reporting servers.

# The server defaults are faster for transactions and fast SELECTs.

# Adjust sizes as needed, experiment to find the optimal values.

# join_buffer_size = 128M

# sort_buffer_size = 2M

# read_rnd_buffer_size = 2M

#

# Remove leading # to revert to previous value for default_authentication_plugin,

# this will increase compatibility with older clients. For background, see:

# https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin

# default-authentication-plugin=mysql_native_password

##########################################

#mkdir  -p  /data/mysql

#mkdir  -p  /data/mysql_binlog

#mkdir  -p  /data/mysql_sys_temp_dir

#chown  -R mysql.mysql /data/mysql

#chown  -R mysql.mysql /data/mysql_binlog

#chown  -R mysql.mysql /data/mysql_sys_temp_dir

#chmod  755 /data/mysql

#chmod  755 /data/mysql_binlog

#chmod  755 /data/mysql_sys_temp_dir

##########################################

[mysql]

default_character_set  =utf8mb4

socket=/data/mysql/mysql.sock

[mysqld@01]

###0、 base DIR

################################################

port=3306

mysqlx_port=33060

lower_case_table_names=1

datadir=/data/mysql

mysqlx_socket=/data/mysql/mysqlx.sock

socket=/data/mysql/mysql.sock

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

skip_name_resolve=ON

###tmpdir 

tmpdir=/data/mysql_sys_temp_dir

innodb_tmpdir=/data/mysql_sys_temp_dir

slave_load_tmpdir=/data/mysql_sys_temp_dir

max_heap_table_size=2g

tmp_table_size=2g

###1、 slow    300ms

################################################

long_query_time=0.6

slow_query_log=ON

log_queries_not_using_indexes=OFF

slow_query_log_file=/data/mysql/localhost-slow.log

###2、binlog gtid\复制优化:

################################################

#expire-logs-days=7

#independ dir /data/mysql_binlog

log_bin=/data/mysql_binlog/binlog

log_bin_index=/data/mysql_binlog/binlog.index

binlog_expire_logs_seconds=604800

binlog_format = ROW

log_timestamps = SYSTEM

gtid-mode                = ON

enforce-gtid-consistency = ON

server_id = 1000

log-slave-updates=ON

skip_slave_start=ON

relay_log_recovery=ON

slave_preserve_commit_order=ON

slave-parallel-type=LOGICAL_CLOCK

slave-parallel-workers=16

binlog_transaction_dependency_tracking = WRITESET

###3、REDO日志缓冲、COMMIT参数:

################################################

## 大日志  800M

##【2000、20000、64000】

innodb_log_file_size = 800M

innodb_log_files_in_group = 5

max_binlog_size = 4096M

innodb_io_capacity  = 10000

innodb_io_capacity_max = 80000

innodb_log_buffer_size = 1024M

innodb_flush_log_at_trx_commit = 2

autocommit=ON

sync_binlog=200

#transaction-isolation=REPEATABLE-READ

transaction-isolation=READ-COMMITTED

####4、线程和调度类参数

################################################

innodb_thread_concurrency=192

thread_cache_size=256

innodb_read_io_threads=80

innodb_write_io_threads=64

innodb_purge_threads=8

#innodb_thread_sleep_delay = 1000

innodb_adaptive_max_sleep_delay=1200000

####5、buffer类参数  96g/128GB

################################################

innodb_buffer_pool_size = 16g

innodb_buffer_pool_instances=2

innodb_change_buffer_max_size = 50

innodb_sort_buffer_size=32M

innodb_max_dirty_pages_pct = 60

innodb_max_dirty_pages_pct_lwm = 10

###6、内存LRU算法相关:

################################################

innodb_old_blocks_pct = 25

innodb_old_blocks_time = 2000

innodb_lru_scan_depth = 4096

###7、索引等其他非典型参数

################################################

##innodb_flush_method = fsync 默认

innodb_use_native_aio = ON

innodb_adaptive_hash_index = ON

max_allowed_packet=1G

###8、表和文件参数

################################################

innodb_file_per_table=1

innodb_open_files=50000

table_open_cache =50000

table_definition_cache=50000

table_open_cache_instances=32

###9、超时与连接参数等其他参数:

################################################

max_connections=20000

max_connect_errors=10000

connect_timeout =8

interactive_timeout=1000

###10、字符集、排序:

################################################

character-set-server =utf8mb4

collation-server =utf8mb4_0900_as_cs

###11、安全密码:

################################################

local_infile=OFF

secure_file_priv=/data/mysql_sys_temp_dir

validate_password.length=10

validate_password.policy=MEDIUM

validate_password.special_char_count=2

validate_password.mixed_case_count=2

validate_password.number_count=2

##########################################

#mkdir  -p  /data/mysql02

#mkdir  -p  /data/mysql02_binlog

#mkdir  -p  /data/mysql02_sys_temp_dir

#chown  -R mysql.mysql /data/mysql02

#chown  -R mysql.mysql /data/mysql02_binlog

#chown  -R mysql.mysql /data/mysql02_sys_temp_dir

#chmod  755 /data/mysql02

#chmod  755 /data/mysql02_binlog

#chmod  755 /data/mysql02_sys_temp_dir

##########################################

[mysqld@02]

###0、 base DIR

################################################

port=3316

mysqlx_port=33160

lower_case_table_names=1

datadir=/data/mysql02

mysqlx_socket=/data/mysql02/mysqlx.sock

socket=/data/mysql02/mysql.sock

log-error=/var/log/mysqld02.log

pid-file=/var/run/mysqld/mysqld02.pid

skip_name_resolve=ON

###tmpdir 

tmpdir=/data/mysql02_sys_temp_dir

innodb_tmpdir=/data/mysql02_sys_temp_dir

slave_load_tmpdir=/data/mysql02_sys_temp_dir

max_heap_table_size=2g

tmp_table_size=2g

###1、 slow    300ms

################################################

long_query_time=0.6

slow_query_log=ON

log_queries_not_using_indexes=OFF

slow_query_log_file=/data/mysql02/localhost-slow.log

###2、binlog gtid\复制优化:

################################################

#expire-logs-days=7

#independ dir /data/mysql02_binlog

log_bin=/data/mysql02_binlog/binlog

log_bin_index=/data/mysql02_binlog/binlog.index

binlog_expire_logs_seconds=604800

binlog_format = ROW

log_timestamps = SYSTEM

gtid-mode                = ON

enforce-gtid-consistency = ON

server_id = 1000

log-slave-updates=ON

skip_slave_start=ON

relay_log_recovery=ON

slave_preserve_commit_order=ON

slave-parallel-type=LOGICAL_CLOCK

slave-parallel-workers=16

binlog_transaction_dependency_tracking = WRITESET

###3、REDO日志缓冲、COMMIT参数:

################################################

## 大日志  800M

##【2000、20000、64000】

innodb_log_file_size = 800M

innodb_log_files_in_group = 5

max_binlog_size = 4096M

innodb_io_capacity  = 10000

innodb_io_capacity_max = 80000

innodb_log_buffer_size = 1024M

innodb_flush_log_at_trx_commit = 2

autocommit=ON

sync_binlog=200

#transaction-isolation=REPEATABLE-READ

transaction-isolation=READ-COMMITTED

####4、线程和调度类参数

################################################

innodb_thread_concurrency=192

thread_cache_size=256

innodb_read_io_threads=80

innodb_write_io_threads=64

innodb_purge_threads=8

#innodb_thread_sleep_delay = 1000

innodb_adaptive_max_sleep_delay=1200000

####5、buffer类参数  96g/128GB

################################################

innodb_buffer_pool_size = 16g

innodb_buffer_pool_instances=2

innodb_change_buffer_max_size = 50

innodb_sort_buffer_size=32M

innodb_max_dirty_pages_pct = 60

innodb_max_dirty_pages_pct_lwm = 10

###6、内存LRU算法相关:

################################################

innodb_old_blocks_pct = 25

innodb_old_blocks_time = 2000

innodb_lru_scan_depth = 4096

###7、索引等其他非典型参数

################################################

##innodb_flush_method = fsync 默认

innodb_use_native_aio = ON

innodb_adaptive_hash_index = ON

max_allowed_packet=1G

###8、表和文件参数

################################################

innodb_file_per_table=1

innodb_open_files=50000

table_open_cache =50000

table_definition_cache=50000

table_open_cache_instances=32

###9、超时与连接参数等其他参数:

################################################

max_connections=20000

max_connect_errors=10000

connect_timeout =8

interactive_timeout=1000

###10、字符集、排序:

################################################

character-set-server =utf8mb4

collation-server =utf8mb4_0900_as_cs

###11、安全密码:

################################################

local_infile=OFF

secure_file_priv=/data/mysql02_sys_temp_dir

validate_password.length=10

validate_password.policy=MEDIUM

validate_password.special_char_count=2

validate_password.mixed_case_count=2

validate_password.number_count=2

Problem shoot:

###########################################################################################################

2019-12-04T17:17:48.335342+08:00 1 [Warning] [MY-012582] [InnoDB] io_setup() failed with EAGAIN. Will make 5 attempts before giving up.

2019-12-04T17:17:48.335549+08:00 1 [Warning] [MY-012583] [InnoDB] io_setup() attempt 1.

2019-12-04T17:17:48.835843+08:00 1 [Warning] [MY-012583] [InnoDB] io_setup() attempt 2.

2019-12-04T17:17:49.336174+08:00 1 [Warning] [MY-012583] [InnoDB] io_setup() attempt 3.

2019-12-04T17:17:49.836813+08:00 1 [Warning] [MY-012583] [InnoDB] io_setup() attempt 4.

2019-12-04T17:17:50.337818+08:00 1 [Warning] [MY-012583] [InnoDB] io_setup() attempt 5.

2019-12-04T17:17:50.838223+08:00 1 [ERROR] [MY-012584] [InnoDB] io_setup() failed with EAGAIN after 5 attempts.

2019-12-04T17:17:50.839214+08:00 1 [ERROR] [MY-012954] [InnoDB] Cannot initialize AIO sub-system

2019-12-04T17:17:50.839419+08:00 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error.

2019-12-04T17:17:50.839611+08:00 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine

2019-12-04T17:17:50.840013+08:00 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.

2019-12-04T17:17:50.840325+08:00 0 [ERROR] [MY-010119] [Server] Aborting

2019-12-04T17:17:50.841661+08:00 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.18)  MySQL Community Server - GPL.

2019-12-04T17:22:24.052559+08:00 0 [Warning] [MY-010139] [Server] Changed limits: max_open_files: 10000 (requested 120010)

2019-12-04T17:22:24.052571+08:00 0 [Warning] [MY-010141] [Server] Changed limits: max_connections: 9190 (requested 20000)

2019-12-04T17:22:24.052578+08:00 0 [Warning] [MY-010142] [Server] Changed limits: table_open_cache: 400 (requested 50000)

2019-12-04T17:22:24.361227+08:00 0 [Warning] [MY-000081] [Server] option 'max_binlog_size': unsigned value 4294967296 adjusted to 1073741824.

2019-12-04T17:22:24.363094+08:00 0 [Warning] [MY-010101] [Server] Insecure configuration for --secure-file-priv: Location is accessible to all OS users. Consider choosing a differ

ent directory.

2019-12-04T17:22:24.363190+08:00 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.18) starting as process 19965

2019-12-04T17:22:24.368825+08:00 0 [Warning] [MY-000081] [Server] option 'innodb-read-io-threads': unsigned value 80 adjusted to 64.

2019-12-04T17:22:24.368927+08:00 0 [Warning] [MY-000081] [Server] option 'innodb-adaptive-max-sleep-delay': unsigned value 1200000 adjusted to 1000000.

2019-12-04T17:22:24.369516+08:00 0 [Warning] [MY-012364] [InnoDB] innodb_open_files should not be greater than the open_files_limit.

2019-12-04T17:22:24.391582+08:00 1 [Warning] [MY-012197] [InnoDB] Unable to open './ops/000/tt7.ibd'

100 200 300 400 500 600 700 800

100 200 300 400 500 600 700 800

100 200 300 400 500 600 700 800

100 200 300 400 500 600 700 800

100 200 300 400 500 600 700 800

2019-12-04T17:23:04.344866+08:00 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.

2019-12-04T17:23:04.383581+08:00 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.18'  socket: '/data/mysql02/mysql.sock'  port: 3316  MySQL

Community Server - GPL.

2019-12-04T17:23:04.465324+08:00 0 [ERROR] [MY-011300] [Server] Plugin mysqlx reported: 'Setup of socket: '/var/run/mysqld/mysqlx.sock' failed, another process with PID 16528 is u

sing UNIX socket file'

2019-12-04T17:23:04.465393+08:00 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33160

[root@qaserver120 log]#

解决:

################################

echo  "fs.aio-max-nr=262144" >>  /etc/sysctl.conf

sysctl -p

2019-12-04T17:34:28.301373+08:00 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.18) starting as process 26348

2019-12-04T17:34:28.308510+08:00 0 [Warning] [MY-000081] [Server] option 'innodb-read-io-threads': unsigned value 80 adjusted to 64.

2019-12-04T17:34:28.308652+08:00 0 [Warning] [MY-000081] [Server] option 'innodb-adaptive-max-sleep-delay': unsigned value 1200000 adjusted to 1000000.

2019-12-04T17:34:28.309514+08:00 0 [Warning] [MY-012364] [InnoDB] innodb_open_files should not be greater than the open_files_limit.

2019-12-04T17:34:28.392497+08:00 1 [ERROR] [MY-012209] [InnoDB] Multiple files found for the same tablespace ID:

2019-12-04T17:34:28.392786+08:00 1 [ERROR] [MY-012202] [InnoDB] Tablespace ID: 97 = ['ops/000/tt7.ibd', 'ops2/tt7.ibd']

2019-12-04T17:34:28.393228+08:00 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Failed, retry may succeed.

2019-12-04T17:34:28.393420+08:00 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine

2019-12-04T17:34:28.393786+08:00 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.

2019-12-04T17:34:28.394080+08:00 0 [ERROR] [MY-010119] [Server] Aborting

2019-12-04T17:34:28.395139+08:00 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.18)  MySQL Community Server - GPL.

解决:

ops/000/tt7.ibd 是copy的表空间文件

###############################################

Multiple files found for the same tablespace ID:

删除即可,重复了

###################################################################

##################################################################

2019-12-05T11:13:24.574282+08:00 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.

2019-12-05T11:13:24.583081+08:00 0 [ERROR] [MY-000067] [Server] unknown variable 'validate_password.length=16'.

2019-12-05T11:13:24.583675+08:00 0 [ERROR] [MY-010119] [Server] Aborting

2019-12-05T11:13:25.866908+08:00 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.18)  MySQL Community Server - GPL.

##############################################################################

数据库初始化方法不正确,导致组件没有启用, 下面的不存在:

component_id  component_group_id  component_urn                     

------------  ------------------  ------------------------------------

          1                  1  file://component_validate_password 

###################################################################

##################################################################

2019-12-04T17:37:23.214806+08:00 0 [Warning] [MY-010139] [Server] Changed limits: max_open_files: 10000 (requested 120010)

2019-12-04T17:37:23.214832+08:00 0 [Warning] [MY-010141] [Server] Changed limits: max_connections: 9190 (requested 20000)

2019-12-04T17:37:23.214844+08:00 0 [Warning] [MY-010142] [Server] Changed limits: table_open_cache: 400 (requested 50000)

2019-12-04T17:37:23.530512+08:00 0 [Warning] [MY-000081] [Server] option 'max_binlog_size': unsigned value 4294967296 adjusted to 1073741824.

2019-12-04T17:37:23.532496+08:00 0 [Warning] [MY-010101] [Server] Insecure configuration for --secure-file-priv: Location is accessible to all OS users. Consider choosing a different directory.

2019-12-04T17:37:23.532607+08:00 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.18) starting as process 27784

2019-12-04T17:37:23.538549+08:00 0 [Warning] [MY-000081] [Server] option 'innodb-read-io-threads': unsigned value 80 adjusted to 64.

2019-12-04T17:37:23.538729+08:00 0 [Warning] [MY-000081] [Server] option 'innodb-adaptive-max-sleep-delay': unsigned value 1200000 adjusted to 1000000.

2019-12-04T17:37:23.539438+08:00 0 [Warning] [MY-012364] [InnoDB] innodb_open_files should not be greater than the open_files_limit.

2019-12-04T17:37:25.867148+08:00 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.

2019-12-04T17:37:25.914579+08:00 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.18'  socket: '/data/mysql02/mysql.sock'  port: 3316  MySQL Community Server - GPL.

2019-12-04T17:37:25.977604+08:00 0 [ERROR] [MY-011300] [Server] Plugin mysqlx reported: 'Setup of socket: '/var/run/mysqld/mysqlx.sock' failed, another process with PID 16528 is using UNIX socket file'

2019-12-04T17:37:25.977762+08:00 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33160

[ERROR] [MY-011300] [Server] Plugin mysqlx reported: 'Setup of socket: '/var/run/mysqld/mysqlx.sock' failed,

another process with PID 16528 is using UNIX socket file'

##############################################################################################################

解决:

mysqlx.sock在同一个服务器上重复了

###############################################

mysql> show variables  like '%socket%';

+-----------------------------------------+-----------------------------+

| Variable_name                          | Value                      |

+-----------------------------------------+-----------------------------+

| mysqlx_socket                          | /var/run/mysqld/mysqlx.sock |

| performance_schema_max_socket_classes  | 10                          |

| performance_schema_max_socket_instances | -1                          |

| socket                                  | /data/mysql/mysql.sock      |

+-----------------------------------------+-----------------------------+

4 rows in set (0.01 sec)

mysql>

[root@qaserver120 log]# netstat -anp |grep "3306\|3316"

tcp6      0      0 :::33160                :::*                    LISTEN      31936/mysqld       

tcp6      0      0 :::3306                :::*                    LISTEN      16528/mysqld       

tcp6      0      0 :::3316                :::*                    LISTEN      31936/mysqld       

tcp6      0      0 :::33060                :::*                    LISTEN      16528/mysqld       

[root@qaserver120 log]#

解决后,日志:

[System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/data/mysql02/mysqlx.sock' bind-address: '::' port: 33160

###############################################

2019-12-04T17:43:50.006244+08:00 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.18)  MySQL Community Server - GPL.

2019-12-04T17:43:52.499102+08:00 0 [Warning] [MY-010139] [Server] Changed limits: max_open_files: 10000 (requested 120010)

2019-12-04T17:43:52.499116+08:00 0 [Warning] [MY-010141] [Server] Changed limits: max_connections: 9190 (requested 20000)

2019-12-04T17:43:52.499123+08:00 0 [Warning] [MY-010142] [Server] Changed limits: table_open_cache: 400 (requested 50000)

2019-12-04T17:43:52.844200+08:00 0 [Warning] [MY-000081] [Server] option 'max_binlog_size': unsigned value 4294967296 adjusted to 1073741824.

2019-12-04T17:43:52.846443+08:00 0 [Warning] [MY-010101] [Server] Insecure configuration for --secure-file-priv: Location is accessible to all OS users. Consider choosing a different directory.

2019-12-04T17:43:52.846571+08:00 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.18) starting as process 31936

2019-12-04T17:43:52.854371+08:00 0 [Warning] [MY-000081] [Server] option 'innodb-read-io-threads': unsigned value 80 adjusted to 64.

2019-12-04T17:43:52.854510+08:00 0 [Warning] [MY-000081] [Server] option 'innodb-adaptive-max-sleep-delay': unsigned value 1200000 adjusted to 1000000.

2019-12-04T17:43:52.855436+08:00 0 [Warning] [MY-012364] [InnoDB] innodb_open_files should not be greater than the open_files_limit.

2019-12-04T17:43:54.944605+08:00 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.

2019-12-04T17:43:54.981407+08:00 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.18'  socket: '/data/mysql02/mysql.sock'  port: 3316  MySQL Community Server - GPL.

2019-12-04T17:43:55.028545+08:00 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/data/mysql02/mysqlx.sock' bind-address: '::' port: 33160

###############################################

不同子目录不能有相同的idb文件,rm就搞定

###############################################

[root@txy93 log]# tail  mysqld.log

2019-12-05T13:48:49.231955+08:00 0 [Warning] [MY-012364] [InnoDB] innodb_open_files should not be greater than the open_files_limit.

2019-12-05T13:48:49.312062+08:00 1 [ERROR] [MY-012209] [InnoDB] Multiple files found for the same tablespace ID:

2019-12-05T13:48:49.312192+08:00 1 [ERROR] [MY-012202] [InnoDB] Tablespace ID: 97 = ['ops/000/tt7.ibd', 'ops2/tt7.ibd']

2019-12-05T13:48:49.312448+08:00 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Failed, retry may succeed.

2019-12-05T13:48:49.312576+08:00 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine

2019-12-05T13:48:49.312872+08:00 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.

2019-12-05T13:48:49.313085+08:00 0 [ERROR] [MY-010119] [Server] Aborting

2019-12-05T13:48:49.314105+08:00 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.18)  MySQL Community Server - GPL.

[root@txy93 log]#

###############################################

###############################################

mysql>

mysql> revoke all on sys.* from 'dbuer'@'%';

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

mysql>

mysql>

mysql> revoke all on ops.* from 'dbuer'@'%';

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

mysql> revoke all on ops.* from 'dbuser'@'%';

ERROR 1141 (42000): There is no such grant defined for user 'dbuser' on host '%'

mysql>

mysql> revoke all on ops2.* from 'dbuser'@'%';

ERROR 1141 (42000): There is no such grant defined for user 'dbuser' on host '%'

mysql>

###############################################

实际上是写错了用户名'dbuer'@'%'

###############################################

[root@txy93 mysql02]#

[root@txy93 mysql02]# netstat  -anp |grep mysqld

tcp6      0      0 :::33160                :::*                    LISTEN      30073/mysqld       

tcp6      0      0 :::3306                :::*                    LISTEN      11076/mysqld       

tcp6      0      0 :::3316                :::*                    LISTEN      30073/mysqld       

tcp6      0      0 :::33060                :::*                    LISTEN      11076/mysqld       

tcp6      0      0 172.31.71.93:3316      103.113.60.164:56999    ESTABLISHED 30073/mysqld       

tcp6      0      0 172.31.71.93:3316      103.113.60.164:20770    ESTABLISHED 30073/mysqld       

unix  2      [ ACC ]    STREAM    LISTENING    2542510600 30073/mysqld        /data/mysql02/mysql.sock

unix  2      [ ACC ]    STREAM    LISTENING    2542509812 30073/mysqld        /data/mysql02/mysqlx.sock

unix  2      [ ACC ]    STREAM    LISTENING    2542415841 11076/mysqld        /data/mysql/mysql.sock

unix  2      [ ACC ]    STREAM    LISTENING    2542425633 11076/mysqld        /data/mysql/mysqlx.sock

unix  2      [ ]        DGRAM                    2542472171 30073/mysqld       

unix  2      [ ]        DGRAM                    2542415769 11076/mysqld       

MySQL8.0多实例管理

###############################################

systemctl enable mysqld@01

systemctl enable mysqld@02

systemctl daemon-reload

systemctl daemon-reload

systemctl start mysqld@01

systemctl start mysqld@02

systemctl status mysqld@01

systemctl status mysqld@02

systemctl stop mysqld@01

systemctl stop mysqld@02

systemctl restart mysqld@01

systemctl restart mysqld@02

systemctl status mysqld@01

systemctl status mysqld@02

netstat -anp |grep "3306\|3316"

netstat -anp |grep "3306\|3316"

netstat  -anp |grep mysqld

netstat  -anp |grep mysqld

###############################################

47.56.108.174  双实例环境

yum  install  -y    /pkg/mysql-community*rpm

##########################################

mkdir  -p  /data/mysql

mkdir  -p  /data/mysql_binlog

mkdir  -p  /data/mysql_sys_temp_dir

chown  -R mysql.mysql /data/mysql

chown  -R mysql.mysql /data/mysql_binlog

chown  -R mysql.mysql /data/mysql_sys_temp_dir

chmod  755 /data/mysql

chmod  755 /data/mysql_binlog

chmod  755 /data/mysql_sys_temp_dir

##########################################

##########################################

mkdir  -p  /data/mysql02

mkdir  -p  /data/mysql02_binlog

mkdir  -p  /data/mysql02_sys_temp_dir

chown  -R mysql.mysql /data/mysql02

chown  -R mysql.mysql /data/mysql02_binlog

chown  -R mysql.mysql /data/mysql02_sys_temp_dir

chmod  755 /data/mysql02

chmod  755 /data/mysql02_binlog

chmod  755 /data/mysql02_sys_temp_dir

##########################################

chown  -R mysql.mysql /data/mysql02

chown  -R mysql.mysql /data/mysql

scp -i  id111.pem    mysql-community*rpm    172.31.71.93:/pkg

scp -i  id111.pem    -r /data/mysql/*    172.31.71.93:/data/mysql/

  scp -i  id111.pem    -r /data/mysql02/*      172.31.71.93:/data/mysql02/

*//

[root@txy93 data]# systemctl enable mysqld@01

systemctl enable mysqld@02

Created symlink from /etc/systemd/system/multi-user.target.wants/mysqld@01.service to /usr/lib/systemd/system/mysqld@.service.

systemctl start mysqld@01[root@txy93 data]# systemctl enable mysqld@02

Created symlink from /etc/systemd/system/multi-user.target.wants/mysqld@02.service to /usr/lib/systemd/system/mysqld@.service.

[root@txy93 data]#

[root@txy93 data]#

/etc/systemd/system/multi-user.target.wants/mysqld@01.service

sed -i 's/LimitNOFILE = 10000/LimitNOFILE = 320000/g'  /etc/systemd/system/multi-user.target.wants/mysqld@01.service

sed -i 's/LimitNOFILE = 200000/LimitNOFILE = 320000/g'  /etc/systemd/system/multi-user.target.wants/mysqld@01.service

cat    /etc/systemd/system/multi-user.target.wants/mysqld@01.service |grep  LimitNOFILE

sed -i 's/LimitNOFILE = 10000/LimitNOFILE = 320000/g'  /etc/systemd/system/multi-user.target.wants/mysqld@02.service

sed -i 's/LimitNOFILE = 200000/LimitNOFILE = 320000/g'  /etc/systemd/system/multi-user.target.wants/mysqld@02.service

cat  /etc/systemd/system/multi-user.target.wants/mysqld@02.service|grep  LimitNOFILE

systemctl daemon-reload

systemctl daemon-reload





mysql> set autocommit=OFF;

Query OK, 0 rows affected (0.00 sec)

mysql>

mysql> START TRANSACTION

    -> ;

Query OK, 0 rows affected (0.00 sec)

mysql>

mysql> SELECT COUNT(*) FROM  dt_game_data.round  ;

+----------+

| COUNT(*) |

+----------+

|  779247 |

+----------+

1 row in set (0.03 sec)

mysql>

mysql> SELECT COUNT(*) FROM  dt_game_data.round_card ;

SELECT COUNT(*) FROM  dt_game_data.round  WHERE created_at <='2019-12-1';

+----------+

| COUNT(*) |

+----------+

|  3876744 |

+----------+

1 row in set (0.09 sec)

mysql>

mysql>

mysql> SELECT COUNT(*) FROM  dt_game_data.round  WHERE created_at <='2019-12-1';

SELECT COUNT(*) FROM  dt_game_data.round_card  WHERE created_at <='2019-12-1';+----------+

| COUNT(*) |

+----------+

|  682691 |

+----------+

1 row in set (0.15 sec)

mysql>

mysql>

mysql> SELECT COUNT(*) FROM  dt_game_data.round_card  WHERE created_at <='2019-12-1';

+----------+

| COUNT(*) |

+----------+

|  3432773 |

+----------+

1 row in set (0.66 sec)

mysql>

mysql> DELETE    FROM  dt_game_data.round  WHERE created_at <='2019-12-1';

Query OK, 682691 rows affected (22.99 sec)

mysql>

mysql>

mysql> COMMIT;

Query OK, 0 rows affected (2.99 sec)

mysql>

mysql>  set autocommit=OFF;

Query OK, 0 rows affected (0.00 sec)

mysql>

mysql> 

mysql>  START TRANSACTION ;

Query OK, 0 rows affected (0.00 sec)

mysql>

mysql>

mysql> DELETE  FROM  dt_game_data.round_card  WHERE created_at <='2019-12-1';

Query OK, 3432773 rows affected (2 min 30.32 sec)

mysql>  SELECT COUNT(*) FROM  dt_game_data.round_card;

+----------+

| COUNT(*) |

+----------+

|  444506 |

+----------+

1 row in set (0.06 sec)

mysql> commit;

Query OK, 0 rows affected (6.03 sec)

mysql>  SELECT COUNT(*) FROM  dt_game_data.round_card;

+----------+

| COUNT(*) |

+----------+

|  444860 |

+----------+

1 row in set (0.02 sec)

mysql>

mysql>

mysql>

mysql>  SELECT COUNT(*) FROM  dt_game_data.round_card;

+----------+

| COUNT(*) |

+----------+

|  445078 |

+----------+

1 row in set (0.01 sec)

mysql> commit;

Query OK, 0 rows affected (0.00 sec)

mysql>

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 212,029评论 6 492
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 90,395评论 3 385
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 157,570评论 0 348
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 56,535评论 1 284
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 65,650评论 6 386
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,850评论 1 290
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,006评论 3 408
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,747评论 0 268
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,207评论 1 303
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,536评论 2 327
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,683评论 1 341
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,342评论 4 330
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,964评论 3 315
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,772评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,004评论 1 266
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,401评论 2 360
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,566评论 2 349

推荐阅读更多精彩内容