Backing Up a Database as Root
It is recommended to back up MySQL databases using the customer's environment. You can do this by either:
- Adding an SSH key or password in the "Developer Tools" section of the website dashboard.
- Logging into the server as root and switching to the website's Unix user.
Steps to Dump a Database as Root:
- Log in to your system as root. If you're using a multi-server cluster, this should be the server running the database role for the website you wish to back up.
- Run the following command to dump the database:
docker exec mysqlcd sh -c "mysqldump database_name_here > /var/backups/database_name.sql"
- The backup file will be saved in
/var/local/enhance/mysqlcd-backups
on the host operating system.
It is recommended to remove the backup file once you're done:
rm /var/local/enhance/mysqlcd-backups/database_name.sql
WARNING:
Be cautious when executing commands as root, especially those that redirect output to files.