Home > Database > Mysql Tutorial > body text

What are the Differences Between `init_connect` and `init-connect` in MySQL?

Susan Sarandon
Release: 2024-11-04 07:47:30
Original
843 people have browsed it

What are the Differences Between `init_connect` and `init-connect` in MySQL?

Understanding the Optional Sections of the MySQL Configuration File (my.ini)

The MySQL configuration file (my.ini) contains various sections that customize the behavior of the MySQL server and its clients. Each section serves a specific purpose and can include multiple options.

Optional Sections:

  • [mysql] (or [mysql.server]): Applies to the MySQL command-line client (mysql).
  • [client] (or [mysql_client]): Applies to all client connections, including the MySQL command-line client.
  • [mysqld] (or [mysqld_server]): Applies to the MySQL server.
  • [mysqldump] (or [mysqldump_options]): Applies to the mysqldump utility.
  • [mysqladmin] (or [mysqladmin_options]): Applies to the mysqladmin utility.

init_connect vs. init-connect:

The difference between init_connect and init-connect lies in the context of their usage.

  • init_connect: Used as a command-line parameter (with a hyphen) to specify an SQL script to execute at the start of each new connection.
  • init-connect: Used as an option in the my.ini configuration file (with an underscore) to set a global SQL script to execute at the start of each connection.

Reference:

For more detailed information on the MySQL configuration file sections and options, refer to the official documentation: https://dev.mysql.com/doc/refman/5.5/en/option-files.html

The above is the detailed content of What are the Differences Between `init_connect` and `init-connect` in MySQL?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!