Create a dump file
If this is running on your local machine, do this. You will need to be inside the container or, in a directory/location that is local to the mysql/mariadb database.
mysqldump --single-transaction --default-character-set=utf8mb4 -h [server] -u [username] -p[password] [db_name] > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
If it is running in a container, you will need to run this command in that container.
docker exec [CONTAINER_NAME_OR_ID] /usr/bin/mysqldump -u [USERNAME] --password=[PASSWORD] [DATABASE_NAME] > [BACKUP_FILE.sql]
Replace:
[CONTAINER_NAME_OR_ID]
with the name or ID of the Docker container running MySQL[USERNAME]
with the MySQL username[PASSWORD]
with the MySQL user's password[DATABASE_NAME]
with the name of the database to dump[BACKUP_FILE.sql]
with the desired name for the SQL backup file
Note:
The typical process of creating a database dump requires connecting to the running database server and executing a command like mysqldump
or pg_dump
to export the database data to a SQL file. However, without a running database instance, these commands cannot be executed.
No Comments