Bug #1458 configure options outside [group] works in 3.23.x but not 4.0.13
Submitted: 1 Oct 2003 13:47 Modified: 9 May 2005 11:52
Reporter: Arjen Lentz Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version:4.0.13 OS:
Assigned to: Brian Aker CPU Architecture:Any

[1 Oct 2003 13:47] Arjen Lentz
Description:
Specifying an option like socket=/tmp/mysql.sock in my.cnf does not work in 4.0.13 unless it is preceded by [mysqld] or other group.

In 3.23 one used to be able to specify options ABOVE the first group, which would work as global options. With options like socket, this is obviously useful since you would want the server as well as all clients to use this option. The only other way would be to copy the option to all groups, which is messy....

Somehow, in 4.0.13, the above no longer works. MySQL reports an error:
 error: Found option without preceding group in config file: /etc/my.cnf at line: 1

This makes no sense. It was a very useful option, why would this now return an error?

How to repeat:
Create a my.cnf with an option outside (or above) any [group], like:

====start of file
socket=/tmp/mysql.sock
====end of file

Suggested fix:
Fix 4.x to use previous (3.23) behaviour.
[17 Oct 2003 9:05] Arjen Lentz
Alternative solution, compatible with 5.x instance concept:

An instance -being a specific MySQL server- has a number of settings that will be relevant not only to the server but also to ALL clients/tools connecting to it. The most obvious are socket and port, but there may be others.

[mysqld1]
socket=/tmp/mysql1.sock
port=3306

Clients should -whenever possible- connect to an instance name rather than a socket/port, and read the options for that instance to know the appropriate socket/port. So they should read the relevant server block, but ignore any options they don't know about.

This solution should also work in 4.x and should in fact be implemented ASAP in the 4.0 and 4.1 trees to resolve the current problems. In the default setting they should read the [mysqld] and [mysql-server] block (or whatever blocks mysqld generally reads).
[9 May 2005 11:52] Brian Aker
Old behavior deprecated. We will add global sections at some point.