From 807e60222822fc61dbe7ea573dbb5adb1ee3e76c Mon Sep 17 00:00:00 2001 From: James Tanner Date: Wed, 16 Oct 2013 09:59:31 -0400 Subject: [PATCH] mysql_db: if connection is a socket, do not specify hostname --- library/database/mysql_db | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/library/database/mysql_db b/library/database/mysql_db index f8ab4bd3b8..771642eb0f 100644 --- a/library/database/mysql_db +++ b/library/database/mysql_db @@ -118,9 +118,11 @@ def db_delete(cursor, db): def db_dump(module, host, user, password, db_name, target, socket=None): cmd = module.get_bin_path('mysqldump', True) - cmd += " --quick --host=%s --user=%s --password=%s" %(host, user, password) + cmd += " --quick --user=%s --password=%s" %(user, password) if socket is not None: cmd += " --socket=%s" % socket + else: + cmd += " --host=%s" % host cmd += " %s" % db_name cmd += " > %s" % target rc, stdout, stderr = module.run_command(cmd) @@ -128,9 +130,11 @@ def db_dump(module, host, user, password, db_name, target, socket=None): def db_import(module, host, user, password, db_name, target, socket=None): cmd = module.get_bin_path('mysqldump', True) - cmd += " --host=%s --user=%s --password=%s" %(host, user, password) + cmd += " --user=%s --password=%s" %(user, password) if socket is not None: cmd += " --socket=%s" % socket + else: + cmd += " --host=%s" % host cmd += " %s" % db_name cmd += " < %s" % target rc, stdout, stderr = module.run_command(cmd)