使用dockerfile 构建自己的nacos-mysql

2023-12-13 03:50:56

前言

在部署nacos的时候触发的脑袋灵光一闪,每次部署nacos都要部署下mysql服务器,然后导入sql语句,配置nacos配置文件,那有没有简单的方法实现一键部署nacos和nacos-mysql 呢?

答案是肯定!如下目录图:

我用的IDE是 Idea 2023

源码下载地址 :docker-mysql-master

1、编写dockerfile

mysql属于oracle 当然要orcale的镜像喽!

下面代码是官方提供的代码 我们需要稍微的改动一下文件添加下面这句话复制init.sql到

/docker-entrypoint-initdb.d/
COPY init.sql /docker-entrypoint-initdb.d/
/docker-entrypoint-initdb.d/ 解释:

?/docker-entrypoint-initdb.d/ 是一个特殊的目录,用于在 Docker 容器启动时运行 SQL 脚本初始化数据库。任何位于该目录下的文件都会在容器启动时被 Docker 引擎执行。这个目录通常用于初始化数据库或设置默认密码等操作。这个功能是为了一些初始化操作可以在容器启动时自动完成,避免了手动登录容器进行初始化的步骤



FROM oraclelinux:7-slim

RUN set -eux; \
	groupadd --system --gid 999 mysql; \
	useradd --system --uid 999 --gid 999 --home-dir /var/lib/mysql --no-create-home mysql

# add gosu for easy step-down from root
# https://github.com/tianon/gosu/releases
ENV GOSU_VERSION 1.16
RUN set -eux; \
# TODO find a better userspace architecture detection method than querying the kernel
	arch="$(uname -m)"; \
	case "$arch" in \
		aarch64) gosuArch='arm64' ;; \
		x86_64) gosuArch='amd64' ;; \
		*) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \
	esac; \
	curl -fL -o /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$gosuArch.asc"; \
	curl -fL -o /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$gosuArch"; \
	export GNUPGHOME="$(mktemp -d)"; \
	gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \
	gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \
	rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \
	chmod +x /usr/local/bin/gosu; \
	gosu --version; \
	gosu nobody true

RUN set -eux; \
# https://github.com/docker-library/mysql/pull/871#issuecomment-1167954236
	yum install -y --setopt=skip_missing_names_on_install=False oracle-epel-release-el7; \
	yum install -y --setopt=skip_missing_names_on_install=False \
		bzip2 \
		gzip \
		openssl \
		xz \
		zstd \
	; \
	yum clean all

RUN set -eux; \
# https://dev.mysql.com/doc/refman/8.0/en/checking-gpg-signature.html
# gpg: key 3A79BD29: public key "MySQL Release Engineering <mysql-build@oss.oracle.com>" imported
	key='859BE8D7C586F538430B19C2467B942D3A79BD29'; \
	export GNUPGHOME="$(mktemp -d)"; \
	gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \
	gpg --batch --export --armor "$key" > /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql; \
	rm -rf "$GNUPGHOME"

ENV MYSQL_MAJOR 5.7
ENV MYSQL_VERSION 5.7.44-1.el7

RUN set -eu; \
	. /etc/os-release; \
	{ \
		echo '[mysql5.7-server-minimal]'; \
		echo 'name=MySQL 5.7 Server Minimal'; \
		echo 'enabled=1'; \
		echo "baseurl=https://repo.mysql.com/yum/mysql-5.7-community/docker/el/${VERSION_ID%%[.-]*}/\$basearch/"; \
		echo 'gpgcheck=1'; \
		echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \
# https://github.com/docker-library/mysql/pull/680#issuecomment-825930524
		echo 'module_hotfixes=true'; \
	} | tee /etc/yum.repos.d/mysql-community-minimal.repo

RUN set -eux; \
	yum install -y --setopt=skip_missing_names_on_install=False "mysql-community-server-minimal-$MYSQL_VERSION"; \
	yum clean all; \
# the "socket" value in the Oracle packages is set to "/var/lib/mysql" which isn't a great place for the socket (we want it in "/var/run/mysqld" instead)
# https://github.com/docker-library/mysql/pull/680#issuecomment-636121520
	grep -F 'socket=/var/lib/mysql/mysql.sock' /etc/my.cnf; \
	sed -i 's!^socket=.*!socket=/var/run/mysqld/mysqld.sock!' /etc/my.cnf; \
	grep -F 'socket=/var/run/mysqld/mysqld.sock' /etc/my.cnf; \
	{ echo '[client]'; echo 'socket=/var/run/mysqld/mysqld.sock'; } >> /etc/my.cnf; \
	\
# make sure users dumping files in "/etc/mysql/conf.d" still works
	! grep -F '!includedir' /etc/my.cnf; \
	{ echo; echo '!includedir /etc/mysql/conf.d/'; } >> /etc/my.cnf; \
	mkdir -p /etc/mysql/conf.d; \
# 5.7 Debian-based images also included "/etc/mysql/mysql.conf.d" so let's include it too
	{ echo '!includedir /etc/mysql/mysql.conf.d/'; } >> /etc/my.cnf; \
	mkdir -p /etc/mysql/mysql.conf.d; \
	\
# comment out a few problematic configuration values
	find /etc/my.cnf /etc/mysql/ -name '*.cnf' -print0 \
		| xargs -0 grep -lZE '^(bind-address|log)' \
		| xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/'; \
	\
# ensure these directories exist and have useful permissions
# the rpm package has different opinions on the mode of `/var/run/mysqld`, so this needs to be after install
	mkdir -p /var/lib/mysql /var/run/mysqld; \
	chown mysql:mysql /var/lib/mysql /var/run/mysqld; \
# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime
	chmod 1777 /var/lib/mysql /var/run/mysqld; \
	\
	mkdir /docker-entrypoint-initdb.d; \
	\
	mysqld --version; \
	mysql --version

RUN set -eu; \
	. /etc/os-release; \
	{ \
		echo '[mysql-tools-community]'; \
		echo 'name=MySQL Tools Community'; \
		echo "baseurl=https://repo.mysql.com/yum/mysql-tools-community/el/${VERSION_ID%%[.-]*}/\$basearch/"; \
		echo 'enabled=1'; \
		echo 'gpgcheck=1'; \
		echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \
# https://github.com/docker-library/mysql/pull/680#issuecomment-825930524
		echo 'module_hotfixes=true'; \
	} | tee /etc/yum.repos.d/mysql-community-tools.repo
ENV MYSQL_SHELL_VERSION 8.0.35-1.el7
RUN set -eux; \
	yum install -y --setopt=skip_missing_names_on_install=False "mysql-shell-$MYSQL_SHELL_VERSION"; \
	yum clean all; \
	\
	mysqlsh --version

VOLUME /var/lib/mysql
COPY init.sql /docker-entrypoint-initdb.d/
COPY docker-entrypoint.sh /usr/local/bin/
RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat
ENTRYPOINT ["docker-entrypoint.sh"]

EXPOSE 3306 33060
CMD ["mysqld"]

2、编写?docker-entrypoint.sh

直接上代码了

#!/bin/bash
set -eo pipefail
shopt -s nullglob

# logging functions
mysql_log() {
	local type="$1"; shift
	# accept argument string or stdin
	local text="$*"; if [ "$#" -eq 0 ]; then text="$(cat)"; fi
	local dt; dt="$(date --rfc-3339=seconds)"
	printf '%s [%s] [Entrypoint]: %s\n' "$dt" "$type" "$text"
}
mysql_note() {
	mysql_log Note "$@"
}
mysql_warn() {
	mysql_log Warn "$@" >&2
}
mysql_error() {
	mysql_log ERROR "$@" >&2
	exit 1
}

# usage: file_env VAR [DEFAULT]
#    ie: file_env 'XYZ_DB_PASSWORD' 'example'
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
#  "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
file_env() {
	local var="$1"
	local fileVar="${var}_FILE"
	local def="${2:-}"
	if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
		mysql_error "Both $var and $fileVar are set (but are exclusive)"
	fi
	local val="$def"
	if [ "${!var:-}" ]; then
		val="${!var}"
	elif [ "${!fileVar:-}" ]; then
		val="$(< "${!fileVar}")"
	fi
	export "$var"="$val"
	unset "$fileVar"
}

# check to see if this file is being run or sourced from another script
_is_sourced() {
	# https://unix.stackexchange.com/a/215279
	[ "${#FUNCNAME[@]}" -ge 2 ] \
		&& [ "${FUNCNAME[0]}" = '_is_sourced' ] \
		&& [ "${FUNCNAME[1]}" = 'source' ]
}

# usage: docker_process_init_files [file [file [...]]]
#    ie: docker_process_init_files /always-initdb.d/*
# process initializer files, based on file extensions
docker_process_init_files() {
	# mysql here for backwards compatibility "${mysql[@]}"
	mysql=( docker_process_sql )

	echo
	local f
	for f; do
		case "$f" in
			*.sh)
				# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
				# https://github.com/docker-library/postgres/pull/452
				if [ -x "$f" ]; then
					mysql_note "$0: running $f"
					"$f"
				else
					mysql_note "$0: sourcing $f"
					. "$f"
				fi
				;;
			*.sql)     mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;;
			*.sql.bz2) mysql_note "$0: running $f"; bunzip2 -c "$f" | docker_process_sql; echo ;;
			*.sql.gz)  mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;;
			*.sql.xz)  mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;;
			*.sql.zst) mysql_note "$0: running $f"; zstd -dc "$f" | docker_process_sql; echo ;;
			*)         mysql_warn "$0: ignoring $f" ;;
		esac
		echo
	done
}

# arguments necessary to run "mysqld --verbose --help" successfully (used for testing configuration validity and for extracting default/configured values)
_verboseHelpArgs=(
	--verbose --help
	--log-bin-index="$(mktemp -u)" # https://github.com/docker-library/mysql/issues/136
)

mysql_check_config() {
	local toRun=( "$@" "${_verboseHelpArgs[@]}" ) errors
	if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then
		mysql_error $'mysqld failed while attempting to check config\n\tcommand was: '"${toRun[*]}"$'\n\t'"$errors"
	fi
}

# Fetch value from server config
# We use mysqld --verbose --help instead of my_print_defaults because the
# latter only show values present in config files, and not server defaults
mysql_get_config() {
	local conf="$1"; shift
	"$@" "${_verboseHelpArgs[@]}" 2>/dev/null \
		| awk -v conf="$conf" '$1 == conf && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }'
	# match "datadir      /some/path with/spaces in/it here" but not "--xyz=abc\n     datadir (xyz)"
}

# Ensure that the package default socket can also be used
# since rpm packages are compiled with a different socket location
# and "mysqlsh --mysql" doesn't read the [client] config
# related to https://github.com/docker-library/mysql/issues/829
mysql_socket_fix() {
	local defaultSocket
	defaultSocket="$(mysql_get_config 'socket' mysqld --no-defaults)"
	if [ "$defaultSocket" != "$SOCKET" ]; then
		ln -sfTv "$SOCKET" "$defaultSocket" || :
	fi
}

# Do a temporary startup of the MySQL server, for init purposes
docker_temp_server_start() {
	if [ "${MYSQL_MAJOR}" = '5.7' ]; then
		"$@" --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}" &
		mysql_note "Waiting for server startup"
		local i
		for i in {30..0}; do
			# only use the root password if the database has already been initialized
			# so that it won't try to fill in a password file when it hasn't been set yet
			extraArgs=()
			if [ -z "$DATABASE_ALREADY_EXISTS" ]; then
				extraArgs+=( '--dont-use-mysql-root-password' )
			fi
			if docker_process_sql "${extraArgs[@]}" --database=mysql <<<'SELECT 1' &> /dev/null; then
				break
			fi
			sleep 1
		done
		if [ "$i" = 0 ]; then
			mysql_error "Unable to start server."
		fi
	else
		# For 5.7+ the server is ready for use as soon as startup command unblocks
		if ! "$@" --daemonize --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}"; then
			mysql_error "Unable to start server."
		fi
	fi
}

# Stop the server. When using a local socket file mysqladmin will block until
# the shutdown is complete.
docker_temp_server_stop() {
	if ! mysqladmin --defaults-extra-file=<( _mysql_passfile ) shutdown -uroot --socket="${SOCKET}"; then
		mysql_error "Unable to shut down server."
	fi
}

# Verify that the minimally required password settings are set for new databases.
docker_verify_minimum_env() {
	if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then
		mysql_error <<-'EOF'
			Database is uninitialized and password option is not specified
			    You need to specify one of the following as an environment variable:
			    - MYSQL_ROOT_PASSWORD
			    - MYSQL_ALLOW_EMPTY_PASSWORD
			    - MYSQL_RANDOM_ROOT_PASSWORD
		EOF
	fi

	# This will prevent the CREATE USER from failing (and thus exiting with a half-initialized database)
	if [ "$MYSQL_USER" = 'root' ]; then
		mysql_error <<-'EOF'
			MYSQL_USER="root", MYSQL_USER and MYSQL_PASSWORD are for configuring a regular user and cannot be used for the root user
			    Remove MYSQL_USER="root" and use one of the following to control the root user password:
			    - MYSQL_ROOT_PASSWORD
			    - MYSQL_ALLOW_EMPTY_PASSWORD
			    - MYSQL_RANDOM_ROOT_PASSWORD
		EOF
	fi

	# warn when missing one of MYSQL_USER or MYSQL_PASSWORD
	if [ -n "$MYSQL_USER" ] && [ -z "$MYSQL_PASSWORD" ]; then
		mysql_warn 'MYSQL_USER specified, but missing MYSQL_PASSWORD; MYSQL_USER will not be created'
	elif [ -z "$MYSQL_USER" ] && [ -n "$MYSQL_PASSWORD" ]; then
		mysql_warn 'MYSQL_PASSWORD specified, but missing MYSQL_USER; MYSQL_PASSWORD will be ignored'
	fi
}

# creates folders for the database
# also ensures permission for user mysql of run as root
docker_create_db_directories() {
	local user; user="$(id -u)"

	local -A dirs=( ["$DATADIR"]=1 )
	local dir
	dir="$(dirname "$SOCKET")"
	dirs["$dir"]=1

	# "datadir" and "socket" are already handled above (since they were already queried previously)
	local conf
	for conf in \
		general-log-file \
		keyring_file_data \
		pid-file \
		secure-file-priv \
		slow-query-log-file \
	; do
		dir="$(mysql_get_config "$conf" "$@")"

		# skip empty values
		if [ -z "$dir" ] || [ "$dir" = 'NULL' ]; then
			continue
		fi
		case "$conf" in
			secure-file-priv)
				# already points at a directory
				;;
			*)
				# other config options point at a file, but we need the directory
				dir="$(dirname "$dir")"
				;;
		esac

		dirs["$dir"]=1
	done

	mkdir -p "${!dirs[@]}"

	if [ "$user" = "0" ]; then
		# this will cause less disk access than `chown -R`
		find "${!dirs[@]}" \! -user mysql -exec chown --no-dereference mysql '{}' +
	fi
}

# initializes the database directory
docker_init_database_dir() {
	mysql_note "Initializing database files"
	"$@" --initialize-insecure --default-time-zone=SYSTEM
	mysql_note "Database files initialized"
}

# Loads various settings that are used elsewhere in the script
# This should be called after mysql_check_config, but before any other functions
docker_setup_env() {
	# Get config
	declare -g DATADIR SOCKET
	DATADIR="$(mysql_get_config 'datadir' "$@")"
	SOCKET="$(mysql_get_config 'socket' "$@")"

	# Initialize values that might be stored in a file
	file_env 'MYSQL_ROOT_HOST' '%'
	file_env 'MYSQL_DATABASE'
	file_env 'MYSQL_USER'
	file_env 'MYSQL_PASSWORD'
	file_env 'MYSQL_ROOT_PASSWORD'

	declare -g DATABASE_ALREADY_EXISTS
	if [ -d "$DATADIR/mysql" ]; then
		DATABASE_ALREADY_EXISTS='true'
	fi
}

# Execute sql script, passed via stdin
# usage: docker_process_sql [--dont-use-mysql-root-password] [mysql-cli-args]
#    ie: docker_process_sql --database=mydb <<<'INSERT ...'
#    ie: docker_process_sql --dont-use-mysql-root-password --database=mydb <my-file.sql
docker_process_sql() {
	passfileArgs=()
	if [ '--dont-use-mysql-root-password' = "$1" ]; then
		passfileArgs+=( "$1" )
		shift
	fi
	# args sent in can override this db, since they will be later in the command
	if [ -n "$MYSQL_DATABASE" ]; then
		set -- --database="$MYSQL_DATABASE" "$@"
	fi

	mysql --defaults-extra-file=<( _mysql_passfile "${passfileArgs[@]}") --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" --comments "$@"
}

# Initializes database with timezone info and root password, plus optional extra db/user
docker_setup_db() {
	# Load timezone info into database
	if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then
		# sed is for https://bugs.mysql.com/bug.php?id=20545
		mysql_tzinfo_to_sql /usr/share/zoneinfo \
			| sed 's/Local time zone must be set--see zic manual page/FCTY/' \
			| docker_process_sql --dont-use-mysql-root-password --database=mysql
			# tell docker_process_sql to not use MYSQL_ROOT_PASSWORD since it is not set yet
	fi
	# Generate random root password
	if [ -n "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then
		MYSQL_ROOT_PASSWORD="$(openssl rand -base64 24)"; export MYSQL_ROOT_PASSWORD
		mysql_note "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD"
	fi
	# Sets root password and creates root users for non-localhost hosts
	local rootCreate=
	# default root to listen for connections from anywhere
	if [ -n "$MYSQL_ROOT_HOST" ] && [ "$MYSQL_ROOT_HOST" != 'localhost' ]; then
		# no, we don't care if read finds a terminating character in this heredoc
		# https://unix.stackexchange.com/questions/265149/why-is-set-o-errexit-breaking-this-read-heredoc-expression/265151#265151
		read -r -d '' rootCreate <<-EOSQL || true
			CREATE USER 'root'@'${MYSQL_ROOT_HOST}' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ;
			GRANT ALL ON *.* TO 'root'@'${MYSQL_ROOT_HOST}' WITH GRANT OPTION ;
		EOSQL
	fi

	local passwordSet=
	# no, we don't care if read finds a terminating character in this heredoc (see above)
	read -r -d '' passwordSet <<-EOSQL || true
		ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ;
	EOSQL

	# tell docker_process_sql to not use MYSQL_ROOT_PASSWORD since it is just now being set
	docker_process_sql --dont-use-mysql-root-password --database=mysql <<-EOSQL
		-- What's done in this file shouldn't be replicated
		--  or products like mysql-fabric won't work
		SET @@SESSION.SQL_LOG_BIN=0;

		${passwordSet}
		GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ;
		FLUSH PRIVILEGES ;
		${rootCreate}
		DROP DATABASE IF EXISTS test ;
	EOSQL

	# Creates a custom database and user if specified
	if [ -n "$MYSQL_DATABASE" ]; then
		mysql_note "Creating database ${MYSQL_DATABASE}"
		docker_process_sql --database=mysql <<<"CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` ;"
	fi

	if [ -n "$MYSQL_USER" ] && [ -n "$MYSQL_PASSWORD" ]; then
		mysql_note "Creating user ${MYSQL_USER}"
		docker_process_sql --database=mysql <<<"CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD' ;"

		if [ -n "$MYSQL_DATABASE" ]; then
			mysql_note "Giving user ${MYSQL_USER} access to schema ${MYSQL_DATABASE}"
			docker_process_sql --database=mysql <<<"GRANT ALL ON \`${MYSQL_DATABASE//_/\\_}\`.* TO '$MYSQL_USER'@'%' ;"
		fi
	fi
}

_mysql_passfile() {
	# echo the password to the "file" the client uses
	# the client command will use process substitution to create a file on the fly
	# ie: --defaults-extra-file=<( _mysql_passfile )
	if [ '--dont-use-mysql-root-password' != "$1" ] && [ -n "$MYSQL_ROOT_PASSWORD" ]; then
		cat <<-EOF
			[client]
			password="${MYSQL_ROOT_PASSWORD}"
		EOF
	fi
}

# Mark root user as expired so the password must be changed before anything
# else can be done (only supported for 5.6+)
mysql_expire_root_user() {
	if [ -n "$MYSQL_ONETIME_PASSWORD" ]; then
		docker_process_sql --database=mysql <<-EOSQL
			ALTER USER 'root'@'%' PASSWORD EXPIRE;
		EOSQL
	fi
}

# check arguments for an option that would cause mysqld to stop
# return true if there is one
_mysql_want_help() {
	local arg
	for arg; do
		case "$arg" in
			-'?'|--help|--print-defaults|-V|--version)
				return 0
				;;
		esac
	done
	return 1
}

_main() {
	# if command starts with an option, prepend mysqld
	if [ "${1:0:1}" = '-' ]; then
		set -- mysqld "$@"
	fi

	# skip setup if they aren't running mysqld or want an option that stops mysqld
	if [ "$1" = 'mysqld' ] && ! _mysql_want_help "$@"; then
		mysql_note "Entrypoint script for MySQL Server ${MYSQL_VERSION} started."

		mysql_check_config "$@"
		# Load various environment variables
		docker_setup_env "$@"
		docker_create_db_directories "$@"

		# If container is started as root user, restart as dedicated mysql user
		if [ "$(id -u)" = "0" ]; then
			mysql_note "Switching to dedicated user 'mysql'"
			exec gosu mysql "$BASH_SOURCE" "$@"
		fi

		# there's no database, so it needs to be initialized
		if [ -z "$DATABASE_ALREADY_EXISTS" ]; then
			docker_verify_minimum_env

			# check dir permissions to reduce likelihood of half-initialized database
			ls /docker-entrypoint-initdb.d/ > /dev/null

			docker_init_database_dir "$@"

			mysql_note "Starting temporary server"
			docker_temp_server_start "$@"
			mysql_note "Temporary server started."

			mysql_socket_fix
			docker_setup_db

			docker_process_init_files /docker-entrypoint-initdb.d/*

			mysql_expire_root_user

			mysql_note "Stopping temporary server"
			docker_temp_server_stop
			mysql_note "Temporary server stopped"

			echo
			mysql_note "MySQL init process done. Ready for start up."
			echo
		else
			mysql_socket_fix
		fi
	fi
	exec "$@"
}

# If we are sourced from elsewhere, don't perform any further actions
if ! _is_sourced; then
	_main "$@"
fi

3、编写-init.sql-Nacos

/*
 * Copyright 1999-2018 Alibaba Group Holding Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/******************************************/
/*   数据库全名 = nacos_config   */
/*   表名称 = config_info   */
/******************************************/
CREATE TABLE `config_info` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `data_id` varchar(255) NOT NULL COMMENT 'data_id',
  `group_id` varchar(128) DEFAULT NULL,
  `content` longtext NOT NULL COMMENT 'content',
  `md5` varchar(32) DEFAULT NULL COMMENT 'md5',
  `gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `src_user` text COMMENT 'source user',
  `src_ip` varchar(50) DEFAULT NULL COMMENT 'source ip',
  `app_name` varchar(128) DEFAULT NULL,
  `tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段',
  `c_desc` varchar(256) DEFAULT NULL,
  `c_use` varchar(64) DEFAULT NULL,
  `effect` varchar(64) DEFAULT NULL,
  `type` varchar(64) DEFAULT NULL,
  `c_schema` text,
  `encrypted_data_key` text NOT NULL COMMENT '秘钥',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_configinfo_datagrouptenant` (`data_id`,`group_id`,`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info';

/******************************************/
/*   数据库全名 = nacos_config   */
/*   表名称 = config_info_aggr   */
/******************************************/
CREATE TABLE `config_info_aggr` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `data_id` varchar(255) NOT NULL COMMENT 'data_id',
  `group_id` varchar(128) NOT NULL COMMENT 'group_id',
  `datum_id` varchar(255) NOT NULL COMMENT 'datum_id',
  `content` longtext NOT NULL COMMENT '内容',
  `gmt_modified` datetime NOT NULL COMMENT '修改时间',
  `app_name` varchar(128) DEFAULT NULL,
  `tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_configinfoaggr_datagrouptenantdatum` (`data_id`,`group_id`,`tenant_id`,`datum_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='增加租户字段';


/******************************************/
/*   数据库全名 = nacos_config   */
/*   表名称 = config_info_beta   */
/******************************************/
CREATE TABLE `config_info_beta` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `data_id` varchar(255) NOT NULL COMMENT 'data_id',
  `group_id` varchar(128) NOT NULL COMMENT 'group_id',
  `app_name` varchar(128) DEFAULT NULL COMMENT 'app_name',
  `content` longtext NOT NULL COMMENT 'content',
  `beta_ips` varchar(1024) DEFAULT NULL COMMENT 'betaIps',
  `md5` varchar(32) DEFAULT NULL COMMENT 'md5',
  `gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `src_user` text COMMENT 'source user',
  `src_ip` varchar(50) DEFAULT NULL COMMENT 'source ip',
  `tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段',
  `encrypted_data_key` text NOT NULL COMMENT '秘钥',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_configinfobeta_datagrouptenant` (`data_id`,`group_id`,`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info_beta';

/******************************************/
/*   数据库全名 = nacos_config   */
/*   表名称 = config_info_tag   */
/******************************************/
CREATE TABLE `config_info_tag` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `data_id` varchar(255) NOT NULL COMMENT 'data_id',
  `group_id` varchar(128) NOT NULL COMMENT 'group_id',
  `tenant_id` varchar(128) DEFAULT '' COMMENT 'tenant_id',
  `tag_id` varchar(128) NOT NULL COMMENT 'tag_id',
  `app_name` varchar(128) DEFAULT NULL COMMENT 'app_name',
  `content` longtext NOT NULL COMMENT 'content',
  `md5` varchar(32) DEFAULT NULL COMMENT 'md5',
  `gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `src_user` text COMMENT 'source user',
  `src_ip` varchar(50) DEFAULT NULL COMMENT 'source ip',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_configinfotag_datagrouptenanttag` (`data_id`,`group_id`,`tenant_id`,`tag_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info_tag';

/******************************************/
/*   数据库全名 = nacos_config   */
/*   表名称 = config_tags_relation   */
/******************************************/
CREATE TABLE `config_tags_relation` (
  `id` bigint(20) NOT NULL COMMENT 'id',
  `tag_name` varchar(128) NOT NULL COMMENT 'tag_name',
  `tag_type` varchar(64) DEFAULT NULL COMMENT 'tag_type',
  `data_id` varchar(255) NOT NULL COMMENT 'data_id',
  `group_id` varchar(128) NOT NULL COMMENT 'group_id',
  `tenant_id` varchar(128) DEFAULT '' COMMENT 'tenant_id',
  `nid` bigint(20) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`nid`),
  UNIQUE KEY `uk_configtagrelation_configidtag` (`id`,`tag_name`,`tag_type`),
  KEY `idx_tenant_id` (`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_tag_relation';

/******************************************/
/*   数据库全名 = nacos_config   */
/*   表名称 = group_capacity   */
/******************************************/
CREATE TABLE `group_capacity` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `group_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'Group ID,空字符表示整个集群',
  `quota` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '配额,0表示使用默认值',
  `usage` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '使用量',
  `max_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个配置大小上限,单位为字节,0表示使用默认值',
  `max_aggr_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '聚合子配置最大个数,,0表示使用默认值',
  `max_aggr_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值',
  `max_history_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最大变更历史数量',
  `gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_group_id` (`group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='集群、各Group容量信息表';

/******************************************/
/*   数据库全名 = nacos_config   */
/*   表名称 = his_config_info   */
/******************************************/
CREATE TABLE `his_config_info` (
  `id` bigint(20) unsigned NOT NULL,
  `nid` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `data_id` varchar(255) NOT NULL,
  `group_id` varchar(128) NOT NULL,
  `app_name` varchar(128) DEFAULT NULL COMMENT 'app_name',
  `content` longtext NOT NULL,
  `md5` varchar(32) DEFAULT NULL,
  `gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `src_user` text,
  `src_ip` varchar(50) DEFAULT NULL,
  `op_type` char(10) DEFAULT NULL,
  `tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段',
  `encrypted_data_key` text NOT NULL COMMENT '秘钥',
  PRIMARY KEY (`nid`),
  KEY `idx_gmt_create` (`gmt_create`),
  KEY `idx_gmt_modified` (`gmt_modified`),
  KEY `idx_did` (`data_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='多租户改造';


/******************************************/
/*   数据库全名 = nacos_config   */
/*   表名称 = tenant_capacity   */
/******************************************/
CREATE TABLE `tenant_capacity` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `tenant_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'Tenant ID',
  `quota` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '配额,0表示使用默认值',
  `usage` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '使用量',
  `max_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个配置大小上限,单位为字节,0表示使用默认值',
  `max_aggr_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '聚合子配置最大个数',
  `max_aggr_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值',
  `max_history_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最大变更历史数量',
  `gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_tenant_id` (`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='租户容量信息表';


CREATE TABLE `tenant_info` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `kp` varchar(128) NOT NULL COMMENT 'kp',
  `tenant_id` varchar(128) default '' COMMENT 'tenant_id',
  `tenant_name` varchar(128) default '' COMMENT 'tenant_name',
  `tenant_desc` varchar(256) DEFAULT NULL COMMENT 'tenant_desc',
  `create_source` varchar(32) DEFAULT NULL COMMENT 'create_source',
  `gmt_create` bigint(20) NOT NULL COMMENT '创建时间',
  `gmt_modified` bigint(20) NOT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_tenant_info_kptenantid` (`kp`,`tenant_id`),
  KEY `idx_tenant_id` (`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='tenant_info';

CREATE TABLE `users` (
	`username` varchar(50) NOT NULL PRIMARY KEY,
	`password` varchar(500) NOT NULL,
	`enabled` boolean NOT NULL
);

CREATE TABLE `roles` (
	`username` varchar(50) NOT NULL,
	`role` varchar(50) NOT NULL,
	UNIQUE INDEX `idx_user_role` (`username` ASC, `role` ASC) USING BTREE
);

CREATE TABLE `permissions` (
    `role` varchar(50) NOT NULL,
    `resource` varchar(255) NOT NULL,
    `action` varchar(8) NOT NULL,
    UNIQUE INDEX `uk_role_permission` (`role`,`resource`,`action`) USING BTREE
);

INSERT INTO users (username, password, enabled) VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', TRUE);

INSERT INTO roles (username, role) VALUES ('nacos', 'ROLE_ADMIN');

4、Docker Image Mysql环境变量设置

| 变量名                 | 变量值          | 说明           |
|---------------------|--------------|--------------|
| MYSQL_ROOT_PASSWORD | 123qwe##     | mysql root密码 |
| MYSQL_DATABASE      | nacos_config | mysql数据库名    |
| MYSQL_USER          | nacos        | mysql用户名     |
| MYSQL_PASSWORD      | 123qwe##     | mysql用户密码    |
| MYSQL_HOST          | %            | 指定mysql地址    |

5、Docker 容器配置

6、生成自己的Nacos-mysql 镜像。

6.1构建日志

Deploying 'nacos-mysql Dockerfile: yc-nacos-mysql/dockerfile'…
Building image…
Preparing build context archive…
[==================================================>]5/5 files
Done

Sending build context to Docker daemon…
[==================================================>] 20.40kB
Done

Step 1/20 : FROM oraclelinux:7-slim
 ---> 506c06ed74d4
Step 2/20 : RUN set -eux;       groupadd --system --gid 999 mysql;      useradd --system --uid 999 --gid 999 --home-dir /var/lib/mysql --no-create-home mysql
 ---> Using cache
 ---> 149cb7eee42f
Step 3/20 : ENV GOSU_VERSION 1.16
 ---> Using cache
 ---> d5327d11c477
Step 4/20 : RUN set -eux;       arch="$(uname -m)";     case "$arch" in                 aarch64) gosuArch='arm64' ;;            x86_64) gosuArch='amd64' ;;    *) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;;        esac;   curl -fL -o /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$gosuArch.asc";        curl -fL -o /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$gosuArch";        export GNUPGHOME="$(mktemp -d)";        gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4;   gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu;       rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc;    chmod +x /usr/local/bin/gosu;   gosu --version; gosu nobody true
 ---> Using cache
 ---> 7a10e99cd095
Step 5/20 : RUN set -eux;       yum install -y --setopt=skip_missing_names_on_install=False oracle-epel-release-el7;    yum install -y --setopt=skip_missing_names_on_install=False             bzip2           gzip            openssl                 xz              zstd    ;       yum clean all
 ---> Using cache
 ---> 352cd65d9fdb
Step 6/20 : RUN set -eux;       key='859BE8D7C586F538430B19C2467B942D3A79BD29';         export GNUPGHOME="$(mktemp -d)";        gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key";        gpg --batch --export --armor "$key" > /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql;       rm -rf "$GNUPGHOME"
 ---> Using cache
 ---> 5fed7d6e6085
Step 7/20 : ENV MYSQL_MAJOR 5.7
 ---> Using cache
 ---> 4cd6aac4a517
Step 8/20 : ENV MYSQL_VERSION 5.7.44-1.el7
 ---> Using cache
 ---> d90fb55e1207
Step 9/20 : RUN set -eu;        . /etc/os-release;      {               echo '[mysql5.7-server-minimal]';               echo 'name=MySQL 5.7 Server Minimal';  echo 'enabled=1';                echo "baseurl=https://repo.mysql.com/yum/mysql-5.7-community/docker/el/${VERSION_ID%%[.-]*}/\$basearch/";               echo 'gpgcheck=1';              echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql';                echo 'module_hotfixes=true';    } | tee /etc/yum.repos.d/mysql-community-minimal.repo
 ---> Using cache
 ---> 44966cebfd61
Step 10/20 : RUN set -eux;      yum install -y --setopt=skip_missing_names_on_install=False "mysql-community-server-minimal-$MYSQL_VERSION";    yum clean all; grep -F 'socket=/var/lib/mysql/mysql.sock' /etc/my.cnf;  sed -i 's!^socket=.*!socket=/var/run/mysqld/mysqld.sock!' /etc/my.cnf;  grep -F 'socket=/var/run/mysqld/mysqld.sock' /etc/my.cnf;       { echo '[client]'; echo 'socket=/var/run/mysqld/mysqld.sock'; } >> /etc/my.cnf;                 ! grep -F '!includedir' /etc/my.cnf;    { echo; echo '!includedir /etc/mysql/conf.d/'; } >> /etc/my.cnf;        mkdir -p /etc/mysql/conf.d;     { echo '!includedir /etc/mysql/mysql.conf.d/'; } >> /etc/my.cnf;        mkdir -p /etc/mysql/mysql.conf.d;               find /etc/my.cnf /etc/mysql/ -name '*.cnf' -print0              | xargs -0 grep -lZE '^(bind-address|log)'              | xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/';             mkdir -p /var/lib/mysql /var/run/mysqld;        chown mysql:mysql /var/lib/mysql /var/run/mysqld;       chmod 1777 /var/lib/mysql /var/run/mysqld;              mkdir /docker-entrypoint-initdb.d;              mysqld --version;       mysql --version
 ---> Using cache
 ---> c37be0578163
Step 11/20 : RUN set -eu;       . /etc/os-release;      {               echo '[mysql-tools-community]';                 echo 'name=MySQL Tools Community';     echo "baseurl=https://repo.mysql.com/yum/mysql-tools-community/el/${VERSION_ID%%[.-]*}/\$basearch/";             echo 'enabled=1';               echo 'gpgcheck=1';              echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql';                echo 'module_hotfixes=true';    } | tee /etc/yum.repos.d/mysql-community-tools.repo
 ---> Using cache
 ---> ae4e17896b0f
Step 12/20 : ENV MYSQL_SHELL_VERSION 8.0.35-1.el7
 ---> Using cache
 ---> 18872e904b82
Step 13/20 : RUN set -eux;      yum install -y --setopt=skip_missing_names_on_install=False "mysql-shell-$MYSQL_SHELL_VERSION";         yum clean all;         mysqlsh --version
 ---> Using cache
 ---> b6e1f947709b
Step 14/20 : VOLUME /var/lib/mysql
 ---> Using cache
 ---> 65bbe7d888a0
Step 15/20 : COPY init.sql /docker-entrypoint-initdb.d/
 ---> Using cache
 ---> 8fad45952ad1
Step 16/20 : COPY docker-entrypoint.sh /usr/local/bin/
 ---> Using cache
 ---> 05b7fd188a49
Step 17/20 : RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat
 ---> Using cache
 ---> dc870e8a34f6
Step 18/20 : ENTRYPOINT ["docker-entrypoint.sh"]
 ---> Using cache
 ---> 2b3914887fbc
Step 19/20 : EXPOSE 3306 33060
 ---> Using cache
 ---> 47f937fa6071
Step 20/20 : CMD ["mysqld"]
 ---> Using cache
 ---> 57b9eff3e8c9

Successfully built 57b9eff3e8c9
Successfully tagged nacos-mysql:latest
Creating container…
Container Id: dd10d3c555977a800d684247bbf2fde7aedc1ca8fc466f12eb8623633a0a9c98
Container name: 'nacos-mysql'
Starting container 'nacos-mysql'
'nacos-mysql Dockerfile: yc-nacos-mysql/dockerfile' has been deployed successfully.


6.2容器启动日志

2023-12-06T05:45:59.858850844Z 2023-12-06 05:45:59+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.44-1.el7 started.
2023-12-06T05:46:00.013146971Z 2023-12-06 05:46:00+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2023-12-06T05:46:00.019866125Z 2023-12-06 05:46:00+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.44-1.el7 started.
2023-12-06T05:46:00.126593631Z 2023-12-06 05:46:00+00:00 [Note] [Entrypoint]: Initializing database files
2023-12-06T05:46:00.135671104Z 2023-12-06T05:46:00.133897Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-12-06T05:46:00.260745583Z 2023-12-06T05:46:00.260279Z 0 [Warning] InnoDB: New log files created, LSN=45790
2023-12-06T05:46:00.294105943Z 2023-12-06T05:46:00.293695Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2023-12-06T05:46:00.356578609Z 2023-12-06T05:46:00.355176Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: bc31cd01-93fa-11ee-89cc-0242ac110002.
2023-12-06T05:46:00.362412649Z 2023-12-06T05:46:00.361790Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2023-12-06T05:46:00.419515051Z 2023-12-06T05:46:00.419178Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2023-12-06T05:46:00.419568578Z 2023-12-06T05:46:00.419217Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2023-12-06T05:46:00.419804886Z 2023-12-06T05:46:00.419534Z 0 [Warning] CA certificate ca.pem is self signed.
2023-12-06T05:46:00.451283525Z 2023-12-06T05:46:00.450838Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2023-12-06T05:46:03.297442118Z 2023-12-06 05:46:03+00:00 [Note] [Entrypoint]: Database files initialized
2023-12-06T05:46:03.298176479Z 2023-12-06 05:46:03+00:00 [Note] [Entrypoint]: Starting temporary server
2023-12-06T05:46:03.299256255Z 2023-12-06 05:46:03+00:00 [Note] [Entrypoint]: Waiting for server startup
2023-12-06T05:46:03.462935561Z 2023-12-06T05:46:03.459918Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-12-06T05:46:03.462985482Z 2023-12-06T05:46:03.460960Z 0 [Note] mysqld (mysqld 5.7.44) starting as process 125 ...
2023-12-06T05:46:03.463528586Z 2023-12-06T05:46:03.463191Z 0 [Note] InnoDB: PUNCH HOLE support available
2023-12-06T05:46:03.463551208Z 2023-12-06T05:46:03.463271Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2023-12-06T05:46:03.463553575Z 2023-12-06T05:46:03.463323Z 0 [Note] InnoDB: Uses event mutexes
2023-12-06T05:46:03.463555104Z 2023-12-06T05:46:03.463328Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2023-12-06T05:46:03.463556403Z 2023-12-06T05:46:03.463330Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.13
2023-12-06T05:46:03.463557670Z 2023-12-06T05:46:03.463333Z 0 [Note] InnoDB: Using Linux native AIO
2023-12-06T05:46:03.464065857Z 2023-12-06T05:46:03.463869Z 0 [Note] InnoDB: Number of pools: 1
2023-12-06T05:46:03.464794894Z 2023-12-06T05:46:03.464571Z 0 [Note] InnoDB: Using CPU crc32 instructions
2023-12-06T05:46:03.466197499Z 2023-12-06T05:46:03.465994Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2023-12-06T05:46:03.470714277Z 2023-12-06T05:46:03.470473Z 0 [Note] InnoDB: Completed initialization of buffer pool
2023-12-06T05:46:03.472201823Z 2023-12-06T05:46:03.471995Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2023-12-06T05:46:03.483721101Z 2023-12-06T05:46:03.483319Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2023-12-06T05:46:03.491312845Z 2023-12-06T05:46:03.490953Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2023-12-06T05:46:03.491365104Z 2023-12-06T05:46:03.491031Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2023-12-06T05:46:03.502096902Z 2023-12-06T05:46:03.501684Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2023-12-06T05:46:03.502374854Z 2023-12-06T05:46:03.502086Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2023-12-06T05:46:03.502388281Z 2023-12-06T05:46:03.502106Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2023-12-06T05:46:03.503470624Z 2023-12-06T05:46:03.503297Z 0 [Note] InnoDB: 5.7.44 started; log sequence number 2768291
2023-12-06T05:46:03.504242888Z 2023-12-06T05:46:03.503949Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2023-12-06T05:46:03.504285805Z 2023-12-06T05:46:03.504094Z 0 [Note] Plugin 'FEDERATED' is disabled.
2023-12-06T05:46:03.505556081Z 2023-12-06T05:46:03.505181Z 0 [Note] InnoDB: Buffer pool(s) load completed at 231206  5:46:03
2023-12-06T05:46:03.508863825Z 2023-12-06T05:46:03.508512Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2023-12-06T05:46:03.508892191Z 2023-12-06T05:46:03.508550Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2023-12-06T05:46:03.508895897Z 2023-12-06T05:46:03.508553Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2023-12-06T05:46:03.508898452Z 2023-12-06T05:46:03.508555Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2023-12-06T05:46:03.509275328Z 2023-12-06T05:46:03.509045Z 0 [Warning] CA certificate ca.pem is self signed.
2023-12-06T05:46:03.509308392Z 2023-12-06T05:46:03.509110Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2023-12-06T05:46:03.512940944Z 2023-12-06T05:46:03.512660Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2023-12-06T05:46:03.516970335Z 2023-12-06T05:46:03.516502Z 0 [Note] Event Scheduler: Loaded 0 events
2023-12-06T05:46:03.517159352Z 2023-12-06T05:46:03.516908Z 0 [Note] mysqld: ready for connections.
2023-12-06T05:46:03.517165340Z Version: '5.7.44'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  MySQL Community Server (GPL)
2023-12-06T05:46:04.313414008Z 2023-12-06 05:46:04+00:00 [Note] [Entrypoint]: Temporary server started.
2023-12-06T05:46:04.327188808Z '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
2023-12-06T05:46:04.334307518Z 2023-12-06T05:46:04.333900Z 3 [Note] InnoDB: Stopping purge
2023-12-06T05:46:04.339950351Z 2023-12-06T05:46:04.339762Z 3 [Note] InnoDB: Resuming purge
2023-12-06T05:46:04.341347902Z 2023-12-06T05:46:04.341141Z 3 [Note] InnoDB: Stopping purge
2023-12-06T05:46:04.344824986Z 2023-12-06T05:46:04.344560Z 3 [Note] InnoDB: Resuming purge
2023-12-06T05:46:04.347857179Z 2023-12-06T05:46:04.347609Z 3 [Note] InnoDB: Stopping purge
2023-12-06T05:46:04.352620331Z 2023-12-06T05:46:04.352344Z 3 [Note] InnoDB: Resuming purge
2023-12-06T05:46:04.353773905Z 2023-12-06T05:46:04.353578Z 3 [Note] InnoDB: Stopping purge
2023-12-06T05:46:04.358259937Z 2023-12-06T05:46:04.358037Z 3 [Note] InnoDB: Resuming purge
2023-12-06T05:46:04.839703139Z Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
2023-12-06T05:46:04.839729029Z Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
2023-12-06T05:46:05.732274102Z Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.
2023-12-06T05:46:05.732316028Z Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
2023-12-06T05:46:05.732318519Z Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
2023-12-06T05:46:05.784854385Z 2023-12-06 05:46:05+00:00 [Note] [Entrypoint]: Creating database nacos_config
2023-12-06T05:46:05.790153334Z 2023-12-06 05:46:05+00:00 [Note] [Entrypoint]: Creating user nacos
2023-12-06T05:46:05.796019216Z 2023-12-06 05:46:05+00:00 [Note] [Entrypoint]: Giving user nacos access to schema nacos_config
2023-12-06T05:46:05.800292086Z 
2023-12-06T05:46:05.800816923Z 2023-12-06 05:46:05+00:00 [Note] [Entrypoint]: /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/init.sql
2023-12-06T05:46:06.141703007Z 
2023-12-06T05:46:06.141759931Z 
2023-12-06T05:46:06.142746681Z 2023-12-06 05:46:06+00:00 [Note] [Entrypoint]: Stopping temporary server
2023-12-06T05:46:06.147604797Z 2023-12-06T05:46:06.147171Z 0 [Note] Giving 0 client threads a chance to die gracefully
2023-12-06T05:46:06.147625861Z 2023-12-06T05:46:06.147219Z 0 [Note] Shutting down slave threads
2023-12-06T05:46:06.147627525Z 2023-12-06T05:46:06.147225Z 0 [Note] Forcefully disconnecting 0 remaining clients
2023-12-06T05:46:06.147628812Z 2023-12-06T05:46:06.147291Z 0 [Note] Event Scheduler: Purging the queue. 0 events
2023-12-06T05:46:06.147639845Z 2023-12-06T05:46:06.147344Z 0 [Note] Binlog end
2023-12-06T05:46:06.148341755Z 2023-12-06T05:46:06.148124Z 0 [Note] Shutting down plugin 'ngram'
2023-12-06T05:46:06.148349018Z 2023-12-06T05:46:06.148145Z 0 [Note] Shutting down plugin 'partition'
2023-12-06T05:46:06.148350578Z 2023-12-06T05:46:06.148148Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2023-12-06T05:46:06.148351830Z 2023-12-06T05:46:06.148150Z 0 [Note] Shutting down plugin 'ARCHIVE'
2023-12-06T05:46:06.148353114Z 2023-12-06T05:46:06.148176Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2023-12-06T05:46:06.148354355Z 2023-12-06T05:46:06.148194Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2023-12-06T05:46:06.148355563Z 2023-12-06T05:46:06.148206Z 0 [Note] Shutting down plugin 'MyISAM'
2023-12-06T05:46:06.148356767Z 2023-12-06T05:46:06.148212Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2023-12-06T05:46:06.148358000Z 2023-12-06T05:46:06.148214Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2023-12-06T05:46:06.148359261Z 2023-12-06T05:46:06.148216Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2023-12-06T05:46:06.148360503Z 2023-12-06T05:46:06.148216Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2023-12-06T05:46:06.148361722Z 2023-12-06T05:46:06.148217Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2023-12-06T05:46:06.148362944Z 2023-12-06T05:46:06.148229Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2023-12-06T05:46:06.148364164Z 2023-12-06T05:46:06.148230Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2023-12-06T05:46:06.148365364Z 2023-12-06T05:46:06.148232Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2023-12-06T05:46:06.148366568Z 2023-12-06T05:46:06.148233Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2023-12-06T05:46:06.148367786Z 2023-12-06T05:46:06.148234Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2023-12-06T05:46:06.148368984Z 2023-12-06T05:46:06.148236Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2023-12-06T05:46:06.148370209Z 2023-12-06T05:46:06.148237Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2023-12-06T05:46:06.148371418Z 2023-12-06T05:46:06.148238Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2023-12-06T05:46:06.148372614Z 2023-12-06T05:46:06.148239Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2023-12-06T05:46:06.148373865Z 2023-12-06T05:46:06.148239Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2023-12-06T05:46:06.148375060Z 2023-12-06T05:46:06.148240Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2023-12-06T05:46:06.148376342Z 2023-12-06T05:46:06.148242Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2023-12-06T05:46:06.148377578Z 2023-12-06T05:46:06.148243Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2023-12-06T05:46:06.148379075Z 2023-12-06T05:46:06.148245Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2023-12-06T05:46:06.148384367Z 2023-12-06T05:46:06.148246Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2023-12-06T05:46:06.148385623Z 2023-12-06T05:46:06.148256Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2023-12-06T05:46:06.148386824Z 2023-12-06T05:46:06.148258Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2023-12-06T05:46:06.148388026Z 2023-12-06T05:46:06.148259Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2023-12-06T05:46:06.148398675Z 2023-12-06T05:46:06.148261Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2023-12-06T05:46:06.148400306Z 2023-12-06T05:46:06.148262Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2023-12-06T05:46:06.148401569Z 2023-12-06T05:46:06.148264Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2023-12-06T05:46:06.148402942Z 2023-12-06T05:46:06.148265Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2023-12-06T05:46:06.148404333Z 2023-12-06T05:46:06.148266Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2023-12-06T05:46:06.148405692Z 2023-12-06T05:46:06.148267Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2023-12-06T05:46:06.148406897Z 2023-12-06T05:46:06.148268Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2023-12-06T05:46:06.148408134Z 2023-12-06T05:46:06.148271Z 0 [Note] Shutting down plugin 'InnoDB'
2023-12-06T05:46:06.148491909Z 2023-12-06T05:46:06.148332Z 0 [Note] InnoDB: FTS optimize thread exiting.
2023-12-06T05:46:06.148591762Z 2023-12-06T05:46:06.148494Z 0 [Note] InnoDB: Starting shutdown...
2023-12-06T05:46:06.249703464Z 2023-12-06T05:46:06.248839Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2023-12-06T05:46:06.249991716Z 2023-12-06T05:46:06.249604Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 231206  5:46:06
2023-12-06T05:46:07.475307343Z 2023-12-06T05:46:07.474510Z 0 [Note] InnoDB: Shutdown completed; log sequence number 12476314
2023-12-06T05:46:07.478384761Z 2023-12-06T05:46:07.477242Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2023-12-06T05:46:07.478424799Z 2023-12-06T05:46:07.477340Z 0 [Note] Shutting down plugin 'MEMORY'
2023-12-06T05:46:07.478431159Z 2023-12-06T05:46:07.477350Z 0 [Note] Shutting down plugin 'CSV'
2023-12-06T05:46:07.478436486Z 2023-12-06T05:46:07.477358Z 0 [Note] Shutting down plugin 'sha256_password'
2023-12-06T05:46:07.478440418Z 2023-12-06T05:46:07.477362Z 0 [Note] Shutting down plugin 'mysql_native_password'
2023-12-06T05:46:07.478444386Z 2023-12-06T05:46:07.477569Z 0 [Note] Shutting down plugin 'binlog'
2023-12-06T05:46:07.479056032Z 2023-12-06T05:46:07.478513Z 0 [Note] mysqld: Shutdown complete
2023-12-06T05:46:07.479098691Z 
2023-12-06T05:46:08.149822396Z 2023-12-06 05:46:08+00:00 [Note] [Entrypoint]: Temporary server stopped
2023-12-06T05:46:08.149942269Z 
2023-12-06T05:46:08.150975998Z 2023-12-06 05:46:08+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.
2023-12-06T05:46:08.151025512Z 
2023-12-06T05:46:08.306771184Z 2023-12-06T05:46:08.304462Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-12-06T05:46:08.306795634Z 2023-12-06T05:46:08.305102Z 0 [Note] mysqld (mysqld 5.7.44) starting as process 1 ...
2023-12-06T05:46:08.307460424Z 2023-12-06T05:46:08.307064Z 0 [Note] InnoDB: PUNCH HOLE support available
2023-12-06T05:46:08.307494374Z 2023-12-06T05:46:08.307095Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2023-12-06T05:46:08.307496191Z 2023-12-06T05:46:08.307098Z 0 [Note] InnoDB: Uses event mutexes
2023-12-06T05:46:08.307497487Z 2023-12-06T05:46:08.307100Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2023-12-06T05:46:08.307498810Z 2023-12-06T05:46:08.307101Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.13
2023-12-06T05:46:08.307500146Z 2023-12-06T05:46:08.307103Z 0 [Note] InnoDB: Using Linux native AIO
2023-12-06T05:46:08.307644310Z 2023-12-06T05:46:08.307452Z 0 [Note] InnoDB: Number of pools: 1
2023-12-06T05:46:08.308006677Z 2023-12-06T05:46:08.307771Z 0 [Note] InnoDB: Using CPU crc32 instructions
2023-12-06T05:46:08.309168963Z 2023-12-06T05:46:08.308977Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2023-12-06T05:46:08.313089162Z 2023-12-06T05:46:08.312783Z 0 [Note] InnoDB: Completed initialization of buffer pool
2023-12-06T05:46:08.314296278Z 2023-12-06T05:46:08.314057Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2023-12-06T05:46:08.326071975Z 2023-12-06T05:46:08.325497Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2023-12-06T05:46:08.334465415Z 2023-12-06T05:46:08.333945Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2023-12-06T05:46:08.334504016Z 2023-12-06T05:46:08.334013Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2023-12-06T05:46:08.343097479Z 2023-12-06T05:46:08.342809Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2023-12-06T05:46:08.343683775Z 2023-12-06T05:46:08.343449Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2023-12-06T05:46:08.343707120Z 2023-12-06T05:46:08.343560Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2023-12-06T05:46:08.345640054Z 2023-12-06T05:46:08.345320Z 0 [Note] InnoDB: Waiting for purge to start
2023-12-06T05:46:08.396397571Z 2023-12-06T05:46:08.395760Z 0 [Note] InnoDB: 5.7.44 started; log sequence number 12476314
2023-12-06T05:46:08.397269613Z 2023-12-06T05:46:08.396535Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2023-12-06T05:46:08.397307560Z 2023-12-06T05:46:08.396668Z 0 [Note] Plugin 'FEDERATED' is disabled.
2023-12-06T05:46:08.401581557Z 2023-12-06T05:46:08.400882Z 0 [Note] InnoDB: Buffer pool(s) load completed at 231206  5:46:08
2023-12-06T05:46:08.403199282Z 2023-12-06T05:46:08.402828Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2023-12-06T05:46:08.403233531Z 2023-12-06T05:46:08.402860Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2023-12-06T05:46:08.403238522Z 2023-12-06T05:46:08.402864Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2023-12-06T05:46:08.403242024Z 2023-12-06T05:46:08.402866Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2023-12-06T05:46:08.403523965Z 2023-12-06T05:46:08.403229Z 0 [Warning] CA certificate ca.pem is self signed.
2023-12-06T05:46:08.403540814Z 2023-12-06T05:46:08.403267Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2023-12-06T05:46:08.403623567Z 2023-12-06T05:46:08.403447Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2023-12-06T05:46:08.403642134Z 2023-12-06T05:46:08.403480Z 0 [Note] IPv6 is available.
2023-12-06T05:46:08.403643883Z 2023-12-06T05:46:08.403489Z 0 [Note]   - '::' resolves to '::';
2023-12-06T05:46:08.403645181Z 2023-12-06T05:46:08.403500Z 0 [Note] Server socket created on IP: '::'.
2023-12-06T05:46:08.407799245Z 2023-12-06T05:46:08.407440Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2023-12-06T05:46:08.416167563Z 2023-12-06T05:46:08.415873Z 0 [Note] Event Scheduler: Loaded 0 events
2023-12-06T05:46:08.416560119Z 2023-12-06T05:46:08.416227Z 0 [Note] mysqld: ready for connections.
2023-12-06T05:46:08.416630935Z Version: '5.7.44'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)

文章来源:https://blog.csdn.net/bj_xuzhiqiang/article/details/134830079
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。