Backup MySQL on Linux
Backup MySQL on Linux
Backing up MySQL databases on Linux can be relatively easy once you get the hang of it..
issue the following command:
mysqldump -u USER -p DATABASENAME > DBNAME.sql
enter your MySQL root password (or whatever user has access to the database)
that may take a minute or two to run, and then you should be returned to the shell prompt
now if we do a ls we should see the Database Dump file in the local directory
if you want to make this process automatic add the following to the command:
mysqldump -u USER -pthepassword DATABASENAME > DBNAME.sql
* Note that there is intentionally no space after the P – do not use the root account if you are scripting, you could end up giving away mysql root password on accident, use a limited mysql account.
from there all you have to do is schedule a cron job to do the dump daily, weekly, or whenever you feel like.
That’s it!
to get a hosted Linux server visit www.zwiegnet.com/go to get started today!
Related guides: MySQL Replication CentOS All Databases | Performing a MySQL Upgrade
