Home >Database >Mysql Tutorial >How do `init_connect` and `init-connect` Differ in MySQL Configuration?
Exploring Sections in the MySQL Configuration File
Navigating the MySQL configuration file can be confusing, especially when deciphering the different sections. Here's a comprehensive guide to help you understand each section:
Optional Sections in my.ini
Distinguishing init_connect from init-connect
The distinction lies in their syntax:
For example, in the my.ini file:
[client] init_connect = "SET sql_log_bin=ON"
This command will set the sql_log_bin variable to ON after connecting.
On the command line:
mysql -u username -p --init-connect="SET sql_log_bin=ON" database_name
This will execute the same command before connecting to the database database_name as user username.
Refer to the MySQL documentation for detailed information on all optional sections and the syntax of init_connect and init-connect:
http://dev.mysql.com/doc/refman/5.5/en/option-files.html
The above is the detailed content of How do `init_connect` and `init-connect` Differ in MySQL Configuration?. For more information, please follow other related articles on the PHP Chinese website!