随笔 - 746  文章 - 0  评论 - 39  阅读 - 79万

Mysql:--init-file && --init-connect

  • init_file

    PropertyValue
    Command-Line Format --init-file=file_name
    System Variable init_file
    Scope Global
    Dynamic No
    SET_VAR Hint Applies No
    Type File name

    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 as CREATE USER or GRANT), replication, and global transaction identifiers. See Section 17.1.3, “Replication with Global Transaction Identifiers”.

 

  • init_connect

    PropertyValue
    Command-Line Format --init-connect=name
    System Variable init_connect
    Scope Global
    Dynamic Yes
    SET_VAR Hint Applies No
    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 or SUPER privilege, the content of init_connect is not executed. This is done so that an erroneous value for init_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 executing init_connect for users that have the CONNECTION_ADMIN or SUPER privilege enables them to open a connection and fix the init_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 thus init_connect execution will fail, leaving the client unable to connect. Skipping init_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.

 

posted on   jinzhenshui  阅读(354)  评论(0编辑  收藏  举报
编辑推荐:
· 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

点击右上角即可分享
微信分享提示