c# - mysqldump.exe not taking full backup of mysql database -
i have procedure backing mysql database.and have different mysql servers. procedure works on of mysql servers.but on of servers won't works proper , create backup file size of 1kb.
code
public void databasebackup(string exelocation, string dbname) { try { string tmestr = ""; tmestr = dbname + "-" + datetime.now.tostring("hh.mm.ss.ffffff") + ".sql"; tmestr = tmestr.replace("/", "-"); tmestr = "c:/" + tmestr; streamwriter file = new streamwriter(tmestr); processstartinfo proc = new processstartinfo(); string cmd = string.format(@"-u{0} -p{1} -h{2} {3}", "uid", "pass", "host", dbname); proc.filename = exelocation; proc.redirectstandardinput = false; proc.redirectstandardoutput = true; proc.arguments = cmd; proc.useshellexecute = false; proc.createnowindow = true; process p = process.start(proc); string res; res = p.standardoutput.readtoend(); file.writeline(res); p.waitforexit(); file.close(); } catch (ioexception ex) { } }
can 1 tell me problem , how can solve it.
finally got answer. need select , lock_table privilege on mysql user or database on want backup. after setting these privilege on database able take full backup of database.
Comments
Post a Comment