Alex, > If I put a copy of my.cnf to <datadir> would that be any help? Any what > is <home_directory>? Sorry I am kind of newbie for in-depth knowledge > of MySQL.
Nope. You don't have three "copies" of my.cnf (one of them actually called .my.cnf, note the dot) to make things more complicated, but to give you more flexibility. Ask the gurus on this list (Paul?! ;-) for a good example why one should have /etc/my.cnf (global options) AND <datadir>/my.cnf (server options). But for .my.cnf, you can use this to store username/password for the MySQL client, or even to store a different socket through which to connect to the server. > And why the /etc/init.d/mysqld (this is a shell script) > still has some hard-coded configuration information even we already > have 3 copies of my.cnf? I had assume it should be able to retrieve > conf info from conf files, and this was what the role of a conf file > supposed to be .... I leave this one to the Linux folks. > [client] > OK, I added this entry into my.cnf, and it does help for connection issued > from command line, but it doesn't work for PHP connection function (issued > drom web). Right. This only works for clients that read the option file(s) when starting. PHP won't, but with PHP that's no problem, as the manual explains for mysql_connect(): "The server parameter can also include a port number. eg. "hostname:port" or a path to a socket eg. ":/path/to/ socket" for the localhost. Note: Support for ":port" was added in PHP 3.0B4. Support for ":/path/to/socket" was added in PHP 3.0.10." Details: http://www.php.net/manual/en/function.mysql-connect.php Regards, -- Stefan Hinz <[EMAIL PROTECTED]> Geschäftsführer / CEO iConnect GmbH <http://iConnect.de> Heesestr. 6, 12169 Berlin (Germany) Tel: +49 30 7970948-0 Fax: +49 30 7970948-3 ----- Original Message ----- From: "Alex Shi" <[EMAIL PROTECTED]> To: "Stefan Hinz, iConnect (Berlin)" <[EMAIL PROTECTED]>; "mysql group" <[EMAIL PROTECTED]> Sent: Monday, February 03, 2003 3:27 AM Subject: Re: datadir and socket > There are three my.cnf you should look for: > > 1) /etc/my.cnf = global options > 2) <datadir>/my.cnf = server options, overriding global options > 3) <home_directory>/.my.cnf = user specific options, overriding server > options Thanks for your reply! The information does make sense. However, I searched the whole file system but found only /etc/my.cnf. If I put a copy of my.cnf to <datadir> would that be any help? Any what is <home_directory>? Sorry I am kind of newbie for in-depth knowledge of MySQL. I am curiouse that why mysql comes with 3 copies of same (?) configuration file. And why the /etc/init.d/mysqld (this is a shell script) still has some hard-coded configuration information even we already have 3 copies of my.cnf? I had assume it should be able to retrieve conf info from conf files, and this was what the role of a conf file supposed to be .... > > To make things a bit more complicated, you cannot only start the server > with the socket option, but also the client (mysql). In the my.cnf's > mentioned above, also check for > > [client] OK, I added this entry into my.cnf, and it does help for connection issued from command line, but it doesn't work for PHP connection function (issued drom web). Alex Shi > > and > > [mysql] > > and see if socket=/var/lib/mysql/mysql.sock is specified anywhere. > > HTH, > -- > Stefan Hinz <[EMAIL PROTECTED]> > Geschäftsführer / CEO iConnect GmbH <http://iConnect.de> > Heesestr. 6, 12169 Berlin (Germany) > Tel: +49 30 7970948-0 Fax: +49 30 7970948-3 > > ----- Original Message ----- > From: "Alex Shi" <[EMAIL PROTECTED]> > To: "mysql group" <[EMAIL PROTECTED]> > Sent: Sunday, February 02, 2003 12:03 AM > Subject: datadir and socket > > > > Hi, > > > > I have a MySQL 2.23.36 running on a Linux RH 7.1. Its database > directory > > is /var/lib/mysql/. For some reason I want to change it to > /home/mysql/. So > > I did following things: > > > > 1. modify /etc/my.cnf: changed all /var/lib/mysql/ to /home/mysql/ > > 2. modyfy /etc/init.d/mysqld: changed /var/lib/mysql/ to /home/mysql/ > > 3. copied all database files from /var/lib/mysql/ to /home/mysql/ > > 4. restart mysqld > > > > OK. everything looks fine for connections from foreign machines. > > However, for local connections, say connections from a locally hosted > > web site via PHP, or a command line connection issued from shell, it > > will return following error message: > > Can't connect to local MySQL server through socket > > '/var/lib/mysql/mysql.sock' > > > > This was weird, since I had assumed that I made all the neccary > changes > > in /etc/my.cnf and /etc/init.d/mysqld. > > > > Seems like mysql has some configure information hard-coded into > > its buildup or whatever, and cannot be modified after installation? > > > > Alex Shi > > > > > > > > --------------------------------------------------------------------- > > Before posting, please check: > > http://www.mysql.com/manual.php (the manual) > > http://lists.mysql.com/ (the list archive) > > > > To request this thread, e-mail <[EMAIL PROTECTED]> > > To unsubscribe, e-mail > <[EMAIL PROTECTED]> > > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > > > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php