Mysql:--init-file && --init-connect
-
If specified, this variable names a file containing SQL statements to be read and executed during the startup process. Prior to MySQL 8.0.18, each statement must be on a single line and should not include comments. As of MySQL 8.0.18, the acceptable format for statements in the file is expanded to support these constructs:
-
delimiter ;
, to set the statement delimiter to the;
character. -
delimiter $$
, to set the statement delimiter to the$$
character sequence. -
Multiple statements on the same line, delimited by the current delimiter.
-
Multiple-line statements.
-
Comments from a
#
character to the end of the line. -
Comments from a
--
sequence to the end of the line. -
C-style comments from a
/*
sequence to the following*/
sequence, including over multiple lines. -
Multiple-line string literals enclosed within either single quote (
'
) or double quote ("
) characters.
If the server is started with the
--initialize
or--initialize-insecure
option, it operates in bootstap mode and some functionality is unavailable that limits the statements permitted in the file. These include statements that relate to account management (such asCREATE USER
orGRANT
), replication, and global transaction identifiers. See Section 17.1.3, “Replication with Global Transaction Identifiers”. -
-
Property Value Command-Line Format --init-connect=name
System Variable init_connect
Scope Global Dynamic Yes SET_VAR
Hint AppliesNo Type String A string to be executed by the server for each client that connects. The string consists of one or more SQL statements, separated by semicolon characters.
For users that have the
CONNECTION_ADMIN
orSUPER
privilege, the content ofinit_connect
is not executed. This is done so that an erroneous value forinit_connect
does not prevent all clients from connecting. For example, the value might contain a statement that has a syntax error, thus causing client connections to fail. Not executinginit_connect
for users that have theCONNECTION_ADMIN
orSUPER
privilege enables them to open a connection and fix theinit_connect
value.init_connect
execution is skipped for any client user with an expired password. This is done because such a user cannot execute arbitrary statements, and thusinit_connect
execution will fail, leaving the client unable to connect. Skippinginit_connect
execution enables the user to connect and change password.The server discards any result sets produced by statements in the value of
init_connect
.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
2017-03-13 windows server 2003R2\2008R2\2012\2016 安装【故障转移群集】cluster