How do I backup my database via command line (SSH)?


mysqldump –-user [user name] –-password=[password] [database name] > [dump file]

Let's take a look at each of the arguments that can be passed to the mysqldump utility, as shown above:



  • --user [user name]: The --user flag followed by a valid MySQL username tells MySQL the username of the account that we want to use to perform the database dump.


  • --password=[password]: The password for the user account mentioned above.


  • [database name]: The name of the database that we would like the mysqldump utility to backup.


  • > [dump file]: If you're familiar with DOS and batch files, then you will know that the ">" symbol specifies that we are directing output to a stream, port, or file. For the mysqldump utility, we prepend a ">" to the filename we would like our database to be backed up to. If no path is specified for the file, then it will be created in the current directory.

Example:
mysqldump --user user_dbuser --password=password user_dbname > sql.dump

In the example above, we're specifying that MySQL should check the grants for the user account of the "admin" user with a password of "password". I'm running MySQL on Windows 2000, and these are the default credentials for the admin user account. I have chosen to backup the database named "mydatabase" into the file sql.dump.
  • 74 Users Found This Useful
Was this answer helpful?

Related Articles

What version of mySQL are you running?

Login to your control panel. On the left side under "Server Info" it tells the mysql version.

How do I create a database?

  To create a database:1. login to your account control panel  2. click "Manage...

Are my databases backed up?

Yes, all database are backed up nightly. We keep backups for 3 days. Do not depend on our backups...

Is Perl DBI available for MySQL?

Yes, we have perl DBI installed with the MySQL DBD.

What version of PHP does Ez-Web-Hosting support?

Login to your control panel. On the left side under "Server Info" it tells the php version.