How can I BACKUP a MySQL database from the command line?

Performing a MySQL Database Dump

From your SSH command prompt type ...
mysqldump -u {username} -p {password} {databasename} > {databasename.sql}

Replace the parameters with the appropriate values

  • {username} - this is your database username
  • {password} - this is the password for your database
  • {databasename} - the name of your database
  • {databasename.sql} - the file to which the backup should be written.

Depending on your Unix/Linux version you may need to type the full path i.e. /usr/local/mysql/bin/mysqldump instead of just mysqldump

The {databasename.sql} file will contain all the SQL statements needed to create the tables and populate them with their current contents.

Example To backup your database myuser_portal with the database username mydbuser and database password mydbpassword to a file portal.sql, you would type the command:
mysqldump -u mydbuser -p mydbpassword myuser_portal > portal.sql

  • 5 Kunder som kunne bruge dette svar
Hjalp dette svar dig?

Relaterede artikler

How do I stop Cpanel reporting /usr/bin/crontab permissions are wrong. Please set to 4755.

If you get this message in CPanel when adding/ediiting/viewing the cron jobs ......

How do I force Statistics (Webalizer and AWstats) to run on Plesk Servers ?

Updating Webalizer and AWStats on Linux Plesk Servers from SSH The plesk control panel is...

How much is HELM ? What Helm licences do you offer ?

Web Host Automation (HELM Authors) sold the control panel rights and code some years ago to...

How to Backup your MySQL DB databases

Backup command for mysql databases For those looking to get a regular backup of your MySQL...

How do I create a MySQL database in Cpanel ?

MySQL databases can be created through the cpanel control panel: Login to your control panel...

Powered by WHMCompleteSolution