Yong, 

If that is the full contents of your my.cnf file, the message is self 
explanatory: you have not specified a [mysql] section header before you 
specify a recognized option.  There is typically only one my.cnf file on 
any machine (exceptions do exist). Each my.cnf file can contain both 
server settings and client settings. The only way the client software 
knows which settings belong to it is by the section headers.

Try this:

[mysql]
user=yong
password=
host=sg1p.net.tamu.edu
socket=/tmp/mysql.sock

The section header I added should make a difference.  For more details on 
how to launch the mysql client, please refer to: 
http://dev.mysql.com/doc/mysql/en/mysql.html

Yours,

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine


"Yong Wang" <[EMAIL PROTECTED]> wrote on 08/18/2004 04:19:47 PM:

> Hi, Shawn:
>      Actually I did exactly as you emailed me. I use
> mysql -h netinfo.tamu.edu -u username -p to access 
> a different host in .my.cnf file. I got the following error
> msg to complain .my.cnf:
> ./mysql -h netinfo.tamu.edu -u hello -p 
> error: Found option without preceding group in config file:
> /home/yong/.my.cnf at line: 1
> Fatal error in defaults handling. Program aborted
> My whole .my.cnffile contents are as follow:
>        user=yong
>         password=
>         host=sg1p.net.tamu.edu
>         socket=/tmp/mysql.sock
> The command line complains the default username is different from the
> other mysql server (one in sg1 , the other is in netinfo)
> How may I fix it ?
>       Thank you very much for your help.
> 
>                  Yong
> 
> >>> <[EMAIL PROTECTED]> 2004-8-18 14:57:50 >>>
> The setting in the my.cnf is just a default setting. It's impossible to
> 
> have more than one default value. Whichever value you specify last is
> what 
> the setting will be.
> 
> When you need to connect to a second server, you need to open another 
> client and specify the hostname you want it to connect to. 2 servers =
> 2 
> clients , 3 servers = 3 clients, and so on. If you are programming and
> 
> need to read data from multiple servers you will have to create
> multiple 
> connections, one for each server you need to work with (exactly how
> would 
> depend on the language you are developing with and the database access
> 
> library you are using)
> 
> mysql -h address.goes.here -u the_user_account_to_login_with -p
> 
> That is the no-frills way to initiate a command line MySQL client
> session 
> with any non-default MySQL server. 
>         The -h parameter indicates that you are specifying a particular
> 
> host. The host name can either be an IP addresss or a FQDN 
> (fully-qualified domain name).
>         The -u identifies what login you want to use on the server you
> 
> specified in -h
>         The -p makes the client prompt you for a password.
> 
> These are all optional parameters. If you don't specify a parameter 
> explicitly , like I did in the example, the default values read from 
> my.cnf are what get used.
> 
> Yours,
> Shawn Green
> Database Administrator
> Unimin Corporation - Spruce Pine
> 
> "Yong Wang" <[EMAIL PROTECTED]> wrote on 08/18/2004 03:22:13
> PM:
> 
> > Hi, all:
> >     In my solaris account, there is a .my.cnf file for me to access
> > mysql in remote machine. 
> > In the current file, it is configured as:
> > host=sg1p.net.tamu.edu
> > socket=/tmp/mysql.socka
> > 
> > If I want to add other remote machine name as netinfo.tamu.edu with
> > mysql in the .my.cnf file,
> > How can i add multiple remote machines with mysql in the .my.cnf ?
> >   Thanks a lot.
> > 
> >  Yong
> > 
> > -- 
> > MySQL General Mailing List
> > For list archives: http://lists.mysql.com/mysql 
> > To unsubscribe: 
> http://lists.mysql.com/[EMAIL PROTECTED] 
> > 

Reply via email to