Backing up a database as root
Last updated: February 2023
Support documentation / Backing up a database as root
Backing up a MySQL database
Normally we recommend backing up MySQL databases using the customer's environment. You can either:
- Add an SSH key or a password to the website under "developer tools" in the website dashboard
- Log in to your server as root and "su" to the website's unix user
Dump a database as root
To dump a database as root:
- Log in to your system as root. If you have a multi server cluster, this should be the server running the database role for the website you wish to back up.
- docker exec mysqlcd sh -c "mysqldump database_name_here > /var/backups/database_name.sql"
- You will find the resulting file in /var/local/enhance/mysqlcd-backups on the host o/s.
- We recommend that you rm the backup file when you're done.
ℹ️ Be careful executing commands as root, especially those which directly redirect output to files.
Still need help?
Our support team are on hand to help 9am-9pm GMT.