Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6660767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:11:46+00:00 2026-05-26T02:11:46+00:00

I have found this solution for back up my database (mysql) using c#.net string

  • 0

I have found this solution for back up my database (mysql) using c#.net

string fname = txtFileName.Text;


if (fname == "")
{

 MessageBox.Show("Please Enter the File Name!");return;
}

try
{

      btnBackup.Enabled = false;
      DateTime backupTime = DateTime.Now;

      int year = backupTime.Year;
      int month = backupTime.Month;

      int day = backupTime.Day;
     int hour = backupTime.Hour;

      int minute = backupTime.Minute;
     int second = backupTime.Second;

     int ms = backupTime.Millisecond;
    String tmestr = backupTime.ToString();

 // C:\Program Files\MySQL\MySQL Server 5.0\bin

   //tmestr = "C:\\" + year + "-" + month + "-" + day + "-" + hour + "-" + minute + ".bak";

    tmestr = "C:\\Program Files\\MySQL\\MySQL Server 5.0\\bin\\" + fname + year + "-" + month + "-" + day + "-" + hour;// +".sql";

   StreamWriter file = new StreamWriter(tmestr);
  ProcessStartInfo proc = new ProcessStartInfo();

    string cmd = string.Format(@"-u{0} -p{1} -h{2} {3}", user, passwd1, Data_Source, dbname);
     proc.FileName = "mysqldump";

   proc.RedirectStandardInput = false;
   proc.RedirectStandardOutput = true;

   proc.Arguments = cmd;//"-u root -p smartdb > testdb.sql";

   proc.UseShellExecute = false;
   Process p = Process.Start(proc);

   string res;
   res = p.StandardOutput.ReadToEnd();

  file.WriteLine(res);

   p.WaitForExit();

  file.Close();

  MessageBox.Show("DataBase Backup Has Been Completed Successfully!");btnBackup.Enabled = true;
}

catch (IOException ex)
{

  MessageBox.Show("Disk full or other IO error , unable to backup!");
}

txtFileName.Text = "";

which value i have to give in this text box "txtfilename.txt"

and what i have to give in this values @"-u{0} -p{1} -h{2} {3}", user, passwd1, Data_Source, dbname

I have found the mysqldump.exe file in this location

string location = "C:\\Program Files\\MySQL\\MySQL WorkBench 5.2CE\\";

and this is my connectionstring

string connestring = "server=localhost;user=root;database=access";

I am not sure which values i have to give in these places user, passwd1, Data_Source, dbname

would any one pls help on this guys

Many thanks..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:11:47+00:00Added an answer on May 26, 2026 at 2:11 am

    First off, the location of mysqldump.exe that you should be using is within the same directory as mysql itself (C:\Program Files\MySQL\MySQL Server 5.5\bin for example), use that and no other copy.

    There is no connection string.

    In the parent directory (ie C:\Program Files\MySQL\MySQL Server 5.5) you’ll find the configuration file my.ini where under the [client] heading you can set the connection settings (username/password etc). Of if you prefer, you specify the login information as arguments when starting the mysqldump process (a list of arguments is provided by MySQL).

    An example, will dump everything in the databases you specify (data, structure, triggers, the lot, and will overwrite any tables when you then import it back again, use the command line arguments depending on what you want).

        public static void DumpStructure()
    {
        Process sd = null;
        ProcessStartInfo r1 = new ProcessStartInfo(/* Full path to MySqlDump.exe */, "--databases exampleDatabase1 exampleDatabase2 --compress --routines --triggers --add-drop-database --add-drop-table --add-locks --extended-insert --password=YOURPASSWORD --port=8307 --user=YOURUSERNAME --disable-keys --quick --comments --complete-insert --result-file=DUMPEDOUTPUT.sql");
    
        r1.CreateNoWindow = true;
        r1.WorkingDirectory = /* WHERE MYSQL.EXE IS STORED */;
        r1.UseShellExecute = false;
        r1.WindowStyle = ProcessWindowStyle.Minimized;
        r1.RedirectStandardInput = false;
    
        sd = Process.Start(r1);
        sd.WaitForExit();
    
        if (!sd.HasExited) {
            sd.Close();
        }
        sd.Dispose();
        r1 = null;
        sd = null;  
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is something I've pseudo-solved many times and have never quite found a solution
i have this problem: ms-access could not delete and i found a potential solution
UPDATE I am still debugging this issue and still have not found a solution.
Original Question mysql-server-6.0.10 I have this problem, I'm using the COMPRESS function to update
I have found this project on Codeplex. http://www.codeplex.com/ProjNET I need to integrate this code
I have found this code for reverse geocoding: var point = new GLatLng (lat[1],long[1]);
I have always found this to be a very useful feature in Visual Studio.
I have just found this great tutorial as it is something that I need.
I have found myself doing this in my code to 'cache' the work done
I found this PHP code in an app I have to modify... $links =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.