Hi James,

Sort of.  If I run the command manually, it does.

But my script uses su to run the server as an unprivileged user.

What happens if you:

su -m mysql -c 'sh -c "/usr/local/bin/mysqld_safe  
--defaults-extra-file=/var/db/mysql/my.cnf --user=mysql --datadir=/var/db/mysql 
--pid-file=/var/db/mysql/www.example.com.pid --bind-address=localhost > /dev/null &"'

Hmm, I don't see why it shouldn't work when run inside su... odd.

As far as I know, there are no requirements for superuser in order to bind to certain IPs.

I'm also hopeful to get multi-IP support, so that I can have the server listen on two NICs or what-have-you, such as:

[mysqld]
bind_address=foo bar localhost

This is a reasonable feature request, and I'll try to do it (I don't see why it can't work). It would require some changes to how the address to bind to are passed around (currently a variable called my_bind_addr).

I haven't tried that yet, so perhaps it is already functional as well, I'll try to get to testing that soon.

It's not.  Here's the code that handles bind-address from sql/mysqld.cc:

  6733    case (int) OPT_BIND_ADDRESS:
  6734      if ((my_bind_addr= (ulong) inet_addr(argument)) == INADDR_NONE)
  6735      {
  6736        struct hostent *ent;
  6737        if (argument[0])
  6738          ent=gethostbyname(argument);
  6739        else
  6740        {
  6741          char myhostname[255];
  6742          if (gethostname(myhostname,sizeof(myhostname)) < 0)
  6743          {
6744 sql_perror("Can't start server: cannot get my own hostname!");
  6745            exit(1);
  6746          }
  6747          ent=gethostbyname(myhostname);
  6748        }
  6749        if (!ent)
  6750        {
  6751          sql_perror("Can't start server: cannot resolve hostname!");
  6752          exit(1);
  6753        }
6754 my_bind_addr = (ulong) ((in_addr*)ent->h_addr_list[0])->s_addr;
  6755      }
  6756      break;


And with other DBs, I can set 'sql.example.com' to resolve to N
IPs (N=4 in this example):

10.0.0.10
10.0.1.10
10.0.2.10
10.0.3.10

Then I can have N separate hosts share the same start-up script,
because the SQL server binds only to those IPs which are local.  Since
each of the N servers has only one of those IPs locally, each
server automatically binds to the correct IP.  And if the IPs ever
change, I just update DNS, and there's no need to do any maintenance
on the start-up scripts. These IPs would not necessarily be in the same subnet and in fact, are CNAMEs, such as sql.example.com
defined as:

sql.example.com.        IN      CNAME dallas-sql.example.com
sql.example.com.        IN      CNAME cleveland-sql.example.com
sql.example.com.        IN      CNAME portland-sql.example.com
sql.example.com.        IN      CNAME sydney-sql.example.com

I am grateful to be making progress.  Thank you for your assistance.

Hmm, I guess you'd expect to at least get warnings for each of these that couldn't be bound to?

This seems like a very strange way to configure a machine. To each, his own. :)

Regards,

Jeremy

--
Jeremy Cole
MySQL Geek, Yahoo! Inc.
Desk: 408 349 5104

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

Reply via email to