summaryrefslogtreecommitdiff
path: root/adbh.py
diff options
context:
space:
mode:
authorSylvain <syt@logilab.fr>2008-03-12 10:41:43 +0100
committerSylvain <syt@logilab.fr>2008-03-12 10:41:43 +0100
commit12edcbdda5cfc0f2feb2d3a256e507755ea6f2ae (patch)
treeeba1ead042a666667b7bc6bb7cdbf2d001945f1c /adbh.py
parent55997cb14b54f7a4ac3cbe131b704405d69c76ee (diff)
downloadlogilab-common-12edcbdda5cfc0f2feb2d3a256e507755ea6f2ae.tar.gz
add -p option to mysql commands to ask for password
Diffstat (limited to 'adbh.py')
-rw-r--r--adbh.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/adbh.py b/adbh.py
index 0efbf9c..7c94c5b 100644
--- a/adbh.py
+++ b/adbh.py
@@ -438,19 +438,19 @@ class _MyAdvFuncHelper(_GenericAdvFuncHelper):
keepownership=True):
"""return a command to backup the given database"""
# XXX compress
- return 'mysqldump -h %s -u %s -r %s %s' % (dbhost, dbuser, backupfile, dbname)
+ return 'mysqldump -h %s -u %s -p -r %s %s' % (dbhost, dbuser, backupfile, dbname)
def restore_commands(self, dbname, dbhost, dbuser, backupfile,
encoding='utf-8', keepownership=True, drop=True):
"""return a list of commands to restore a backup the given database"""
cmds = []
if drop:
- cmd = 'echo "DROP DATABASE %s;" | mysql -h %s -u %s' % (dbname, dbhost, dbuser)
+ cmd = 'echo "DROP DATABASE %s;" | mysql -h %s -u %s -p' % (dbname, dbhost, dbuser)
cmds.append(cmd)
- cmd = 'echo "%s;" | mysql -h %s -u %s' % (self.sql_create_database(dbname, encoding),
+ cmd = 'echo "%s;" | mysql -h %s -u %s -p' % (self.sql_create_database(dbname, encoding),
dbhost, dbuser)
cmds.append(cmd)
- cmd = pgdbcmd('mysql -h %s -u %s < %s' % (dbname, dbhost, dbuser, backupfile))
+ cmd = pgdbcmd('mysql -h %s -u %s -p < %s' % (dbname, dbhost, dbuser, backupfile))
cmds.append(cmd)
return cmds