To import/export a MySQL/MariaDB database, you will need access to a server with MySQL/MariaDB, database name and user credentials for it.
Export the database
The mysqldump client utility performs logical backups, producing a set of SQL statements that can be executed to reproduce the original database object definitions and table data.
# mysqldump -u username -p database_name > dump_name.sql
It will export database to SQL text files.
Import the database
To import a dump, you need to create a new database.
– log in as root or another user.
# mysql -u root -p
– create a new database.
# mysql > CREATE DATABASE new_database;
– exit the shell by pressing CTRL+D
– import the dump
# mysql -u username -p database_name < dump_name.sql
If the import runs successfully, you won’t get any output. If any errors occur during the process, MySQL will print them.