Koozali.org: home of the SME Server

mysql port 3306 not 'sticking' ?

Offline allanr

  • *
  • 8
  • +0/-0
mysql port 3306 not 'sticking' ?
« on: January 19, 2011, 02:28:29 AM »
Hi Folks,
 If someone can tell me what I'm doing wrong, or give me a couple of pointers, or point me to where i need to read, it would be greatly appreciated ?

I've run the following commands :

config setprop mysqld LocalNetworkingOnly no
expand-template /etc/my.cnf
sv t /service/mysqld

config set mysqld service access public status enabled TCPPort 3306
signal-event remoteaccess-update
signal-event reboot

From the wiki page on sme mysql to access it from port 3306 rather than socket.

Works a treat, but when the server is re-booted, it's like I've lost the port setting and need to re-run the commands.

As a rather new, but competent, sme server convert, how can I get the change to 'stick', or what should I be searching for to find out what to do to make it stick ? At the moment we are utilising a mysql database across a dozen workstations on the lan and myself locally & remotely, but without running the commands after reboot, no one has access across the LAN or remotely.

Thanks in advance for any suggestions.
Cheers,
al.

Offline mmccarn

  • *
  • 2,653
  • +10/-0
Re: mysql port 3306 not 'sticking' ?
« Reply #1 on: January 19, 2011, 01:46:00 PM »
For LAN access to mysqld, you only need to set 'LocalNetworkingOnly' to no, then create users with access from other IPs.

The second command - config set mysqld service access public status enabled TCPPort 3306 is only needed if you *also* want to allow remote access to your sql server from the Internet - these settings (access=public, status=enabled, TCPPort=3306) only affect the firewall (/etc/init.d/masq), and don't have any effect on /etc/my.cnf.

Here's a 'diff -u' showing what changes on my system when I change LocalNetworkingOnly from no to yes:
Code: [Select]
-- my.cnf.LocalNetworkingOnly  2011-01-19 07:18:08.000000000 -0500
+++ /etc/my.cnf 2011-01-19 07:18:18.000000000 -0500
@@ -47,7 +47,7 @@
 datadir=/var/lib/mysql
 skip-innodb
 socket=/var/lib/mysql/mysql.sock
-skip-networking
+# networking is enabled
 log-error=/var/log/mysqld.log
 max_allowed_packet=16M
 user=mysql

Recommendations:
- Don't open the firewall unless you really need to.  If you do, you probably also want to restrict access to a limited range of remote IPs (using, for example, config setprop mysqld AllowHosts a.b.c.d,x.y.z.0/24).

- Get mysqld access working as you want - save a copy of /etc/my.cnf - then reboot.  After rebooting, check to see if /etc/my.cnf has changed, and if mysqld is still listening on port 3306 (netstat -an | grep \:3306)

Offline allanr

  • *
  • 8
  • +0/-0
Re: mysql port 3306 not 'sticking' ?
« Reply #2 on: January 19, 2011, 10:47:08 PM »
Thanks for the pointers, Appreciate your help !

Offline janet

  • *****
  • 4,812
  • +0/-0
Re: mysql port 3306 not 'sticking' ?
« Reply #3 on: January 20, 2011, 05:52:17 AM »
allanr


Quote
config setprop mysqld LocalNetworkingOnly no
expand-template /etc/my.cnf
sv t /service/mysqld

config set mysqld service access public status enabled TCPPort 3306
signal-event remoteaccess-update
signal-event reboot

These commands appear correct

Quote
Works a treat, but when the server is re-booted, it's like I've lost the port setting and need to re-run the commands.

Sounds like you are guessing, which is NOT a good way to troubleshoot.
Use db commands to interrogate the database settings & prove to yourself what the settings really are and that you did enter them correctly.

config show mysqld
Run the above before and after each set of commands and after a reboot

The db settings should remain unchanged after a reboot.

Please show the before and after settings from that command.

It the db settinge are truly changing after a reboot, then something else is causing it ie maybe a custom template.
« Last Edit: January 20, 2011, 10:49:24 AM by mary »
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline allanr

  • *
  • 8
  • +0/-0
Re: mysql port 3306 not 'sticking' ?
« Reply #4 on: January 20, 2011, 06:11:29 AM »
Thanks Mary,
 Fair points, will do, but I'm at a remote mine site for the coming week so I'll have to give it a nudge when I get back !

Cheers,
al.