From 6c74dde2bfafe7db0029672b22023af365d2caa7 Mon Sep 17 00:00:00 2001 From: Alexander Lutay Date: Wed, 20 Aug 2014 18:47:26 +0200 Subject: [PATCH] MT#8117 Swtich defaults from 127.0.0.1 to localhost We have a regression here for CE during the upgrade mr3.4->trunk: > Removing proj-data ... > ... > Synchronizing data from /etc/ngcp-config/constants.yml > DBI connect('database=mysql;host=127.0.0.1;port=3306','sipwise',...) failed: > Can't connect to MySQL server on '127.0.0.1' (111) > at /usr/sbin/ngcp-sync-constants line 131 > Can't connect to MySQL database mysql: Can't connect to MySQL server on > '127.0.0.1' (111) at /usr/sbin/ngcp-sync-constants line 131. It happens because MySQL listens Unix sockets only (due to "skip_networking" in my.cnf) It doesn't affect newly installed CE trunk, because it has defaults in /etc/ngcp-config/config.yml: > database: > central: > dbhost: localhost > pair: > dbhost: localhost While upgraded system not yet received those options (ngcp-upgrade-cfg-schema will be called later). So, we need to change defaults here to localhost. MySQL always uses unix sockets for 'localhost'. Change-Id: I0f07c43ea68ed47b653242cd87ed74e7351dcc1c --- sbin/ngcp-sync-constants | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sbin/ngcp-sync-constants b/sbin/ngcp-sync-constants index beb6f6b3..b00fa789 100755 --- a/sbin/ngcp-sync-constants +++ b/sbin/ngcp-sync-constants @@ -515,7 +515,7 @@ sub copy_passwords { } sub do_pair_sync { - my $dbhost = $config->[0]->{database}->{pair}->{dbhost} || "127.0.0.1"; + my $dbhost = $config->[0]->{database}->{pair}->{dbhost} || "localhost"; my $dbport = $config->[0]->{database}->{pair}->{dbport} || 3306; system("/usr/share/ngcp-ngcpcfg/helper/check-for-mysql"); @@ -556,7 +556,7 @@ sub get_slave_hosts { sub do_grant_slaves { - my $dbhost = $config->[0]->{database}->{pair}->{dbhost} || "127.0.0.1"; + my $dbhost = $config->[0]->{database}->{pair}->{dbhost} || "localhost"; my $dbport = $config->[0]->{database}->{pair}->{dbport} || 3306; my $user = $yml->[0]->{mysql}->{repuser}; my $pwd = $yml->[0]->{mysql}->{reppassword}; @@ -595,7 +595,7 @@ sub do_slave_sync { my $dbhost = $yml->[0]->{database}->{dbhost}; my $dbport = $yml->[0]->{database}->{dbport}; - my $mhost = $config->[0]->{database}->{central}->{dbhost} || "127.0.0.1"; + my $mhost = $config->[0]->{database}->{central}->{dbhost} || "localhost"; my $mport = $config->[0]->{database}->{central}->{dbport} || 3306; my $user = $yml->[0]->{mysql}->{repuser}; my $pass = $yml->[0]->{mysql}->{reppassword};