Kevin Cowley [mailto:[EMAIL PROTECTED] wrote:

>Thanks for the response but I already knew about that page. 
>The problem is with a client application it doesn't know anything about how 
>the server is configured and it doesn't matter.
>
>Basically it's a case of doing
>
>main(int argc, char **argv)
>{
>       my_init();
>       load_defaults();
>       handle_options();
>}
>
>So you need to be able to tell load_defaults where to locate the .my.cnf
>file so it can go and load the defaults.

Are you on a *ix system?

You might try something like this, assuming that you know the name of
the script that starts the mysql daemon at boot time:

#!/bin/sh
mysqld=/etc/init.d/mysqld
realmysqlserver=`awk '$2 == "start" {print $1;exit}' < "$mysqld"`
mydotconf=`grep '^[  ]*conf=' "$realmysqlserver" | sed 's/^.*=//'`
mysqldatadir=`grep '^[  ]*datadir=' "$realmysqlserver" | sed 's/^.*=//'`

As you might guess, I use a technique like this to locate the MySQL
data directory in scripts I run overnight to check the databases
and manage backups.

Steve Bacher
System Administrator
Draper Laboratory
[EMAIL PROTECTED]



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to