Creating a backup copy of MariaDB databases can be done by using the `mysqldump` command, which is an effective tool for performing this action.
Here are the steps to perform this task:
1. Firstly, open your terminal or command line interface.
1. Run the `mysqldump` command along with the necessary parameters. For example, if your database name is ‘mydatabase’ and your username is ‘myuser’, and you want to save the backup into a file named ‘backup.sql’, the command would look like this:
\`\`\` mysqldump -u myuser -p mydatabase > backup.sql \`\`\` This command prompts for the password for user ‘myuser’. After entering the password, it will create a backup and store it in ‘backup.sql’.1. If you want to include more databases in the backup, you can do so by specifying them:
\`\`\` mysqldump -u myuser -p —databases database_one database_two > two_databases_backup.sql \`\`\` This command backups ‘database_one’ and ‘database_two’ into a file named ‘two_databases_backup.sql’.1. If you want to backup all databases, you can replace ‘—databases database_one database_two’ with ‘—all-databases’:
\`\`\` mysqldump -u myuser -p —all-databases > all_databases_backup.sql \`\`\` This command backups all databases into a file named ‘all_databases_backup.sql’.1. After hitting enter, the tool will prompt you to enter a password for the user.
1. Once well executed, `mysqldump` will generate a `.sql` file which you can import back into the server using the `mysql` command line tool or any other MySQL/MariaDB database management software.
Remember to secure your backup `.sql` file by changing its permission and store it in a safe place.
Gist: Be aware that when running these commands, especially those including more databases or all databases, the process could take some time, depending on the size of your databases.