MySQL "bind-address", auto-bind

  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post September 9th, 2011, 6:06 pm

Is there a way to have MySQL automatically detect the IP address of the machine it's on and set the "bind-address" configuration variable itself? This is a small home server using DHCP that's used periodically and I really don't want to go through setting up static IP addresses.
Strong with this one, the sudo is.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post September 9th, 2011, 6:06 pm

  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post September 9th, 2011, 7:14 pm

http://dev.mysql.com/doc/refman/5.0/en/ ... rties.html

I've never done what you're trying to do (not sure if I even completely understand what you're trying to do), but hope that helps.
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post September 9th, 2011, 7:24 pm

Basically in "/etc/mysql/my.cnf", there is a configuration variable called "bind-address" which tells MySQL servers which IP address on the machine to bind to. The variable is set during the MySQL installation.

In my case, the IP address of the machine will change now and then. If I start the server and DHCP has given the machine a different address, MySQL will fail to start until I edit my.cnf and update the IP address.

This machine will only ever have one IP address at a time, so I'm hoping it is possible to have MySQL be smart enough to say hey, there's only one address available anyways, let's just bind to that.
Strong with this one, the sudo is.
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Joined: May 22, 2004
  • Posts: 3415
  • Loc: Richland, WA
  • Status: Offline

Post September 10th, 2011, 11:15 am

You should be able to set to it to 'bind-address = 0.0.0.0' and it will bind to what ever it can.
#define NULL (::rand() % 2)
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post September 11th, 2011, 4:42 am

Worked like a charm, Spoof. Thank you. :D
Strong with this one, the sudo is.

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 30 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.