Let us understand how to specify options in MySQL program. There are several ways to specify options for a MySQL program −
After entering the program name, the options on the command line must be listed. This is a common procedure that applies to specific program calls.
You also need to list the options in the option file that the program reads when it starts. This is a common step where users need options every time the program is run.
Need to list the options in the environment variables. This approach is very helpful for options that require the user to apply the option every time they run the program.
In real life, option files are more commonly used for this purpose, they can also be used to run multiple MySQL instances on Unix.
Options are processed sequentially. This means that if an option is specified multiple times, the last occurrence of that option will take precedence.
The following command will cause mysql to connect to a server running on localhost −
mysql −h example.com −h localhost
The MySQL program determines which options are provided first by examining environment variables. Then, process the options file by examining the command line.
Since later options take precedence over earlier options, the order of processing means that environment variables have the lowest priority and command line options have the highest priority.
The above is the detailed content of How to specify options for MySQL program?. For more information, please follow other related articles on the PHP Chinese website!