diff --git a/slapos/recipe/erp5/src/slapos/recipe/erp5/mysql.py b/slapos/recipe/erp5/src/slapos/recipe/erp5/mysql.py
index 5ea308b6c8f1eddba6b8e71c8bcbd052accbfd88..3efa2f4db07febdcc2fc9f20d8e77efa2e37e32b 100644
--- a/slapos/recipe/erp5/src/slapos/recipe/erp5/mysql.py
+++ b/slapos/recipe/erp5/src/slapos/recipe/erp5/mysql.py
@@ -31,15 +31,18 @@ def updateMysql(args):
   mysql_command_list = args[0]
   mysql_script = args[1]
   sleep = 30
+  is_succeed = False
   while True:
-    mysql = subprocess.Popen(mysql_command_list, stdin=subprocess.PIPE,
-        stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
-    result = mysql.communicate(mysql_script)[0]
-    if mysql.returncode is None:
-      mysql.kill()
-    if mysql.returncode != 0:
-      print 'Script failed with: %s' % result
-      print 'Sleeping for %ss and retrying' % sleep
-    else:
-      print 'Script succesfully run on database, exiting'
+    if not is_succeed:
+      mysql = subprocess.Popen(mysql_command_list, stdin=subprocess.PIPE,
+          stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+      result = mysql.communicate(mysql_script)[0]
+      if mysql.returncode is None:
+        mysql.kill()
+      if mysql.returncode != 0:
+        print 'Script failed with: %s' % result
+        print 'Sleeping for %ss and retrying' % sleep
+      else:
+        is_succeed = True
+        print 'Script succesfully run on database, exiting'
     time.sleep(sleep)